A regular expression written by a friend

Source: Internet
Author: User

The universe shines on the dragon, 13:00:33
Oh, by the way, create a regular expression.
13:00:46 AM
Regular Expression?
The universe shines on the dragon, 13:00:58
Only numbers and letters are allowed, and numbers and letters are required.
13:13:21 AM
^ [A-zA-Z0-9] + $
The universe shines on the dragon, 13:17:14
123456
The universe shines on the dragon, 13:17:22
In this way, he is satisfied.
The universe shines on the dragon, 13:17:26
Asdfgh
The universe shines on the dragon, 13:17:32
He also satisfies
13:17:34 AM
Yes
13:17:48 AM
So what is not enough?
The universe shines on the dragon, 13:17:58
This is not the case. It cannot be all numbers or letters.
13:18:48 AM
What's your requirement?
The universe shines on the dragon, 13:19:42
Yes
13:29:40 AM
^ ([A-Za-Z] [0-9]) + | ([0-9] [A-Za-Z]) + | ([A-Za-Z] [0-9]) + $

-------------------------------------------------------
He must only have numbers and letters, and contain numbers and letters.
I wrote so long:
^ ([A-Za-Z] [0-9]) + | ([0-9] [A-Za-Z]) + | ([A-Za-Z] + [0-9] +) + | ([0-9] + [A-Za-Z] +) + $

or ^ (\ D + [A-Za-Z] + \ D *) | ([A-Za-Z] + \ D + [A-Za-Z] *) $
or ^ ([A-Za-Z] * \ D + [A-Za-Z] +) | ([A-Za-Z] + \ D + [A-Za-Z] *) $
the test is normal, however, I do not know whether there are more concise

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.