Implementation of regular expression matching strings

Source: Internet
Author: User
Tags expression regular expression

The most common use of regular expressions is to consider the implementation of regular expression matching judgment, in the actual work will often encounter what needs to match the string operation? Let's look at an example of an operation that implements a regular expression matching string.

Regular expression matches a string instance:

^[A-Za-z]+$

  //匹配由26个英文字母组成的字符串

^[A-Z]+$

//匹配由26个英文字母的大写组成的字符串

^[a-z]+$

  //匹配由26个英文字母的小写组成的字符串

^[A-Za-z0-9]+$

  //匹配由数字和26个英文字母组成的字符串

^\w+$

//匹配由数字、26个英文字母或者下划线组成的字符串

Note: Some of the most basic and commonly used expressions

The regular expression matches the relevant content of the string to introduce you here, hoping to learn from you and learn to use regular expressions to match strings helps.

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.