JavaScript essay 8

Source: Internet
Author: User

Regular Expressions:
Search (a);//Query the location of a
SUBSTRING (2,5)//Get to 2 to 4 bits
Chartat (3);//Get to 3rd place
Split ('-');//-Slice
(1)
RegExp Object
JS notation:-----New RegExp ("A", "I");//i ignores case, finds a
Perl notation:-----/a/i
Search
/a/i
(2)
Match gets a matching item
/\d/: Escape//Find first number
/\d/g://found all the numbers and was sliced.
/\d+/g//Find all the numbers that are not sliced
(3)
Replace
re =/a/g;
Str.replace (Re, ' 0 ');
(4)
[Abc]a=aa, BA, CA
Cases
[A-z]:a to Z
[0-9]:0 to 9
[^a-z]: exclude A to Z
(5)
Escape character
. (dot)-----Any character
(6)
The characteristic greed of the regular--match as much as possible
(7)
Commonly used escape characters
\d Digital
\w English, numerals, underline
\s whitespace characters
\D[^0-9]
\w non-English, numerals, underline
\s non-English, numerals, underline
(8)
Quantifier: Number
{n}//occurs exactly n times
{n,m}//at least n times, up to M times
{n,}//at least n times, Maximum unlimited
Cases
\D{8}//8 a number
(0).//0 dispensable
Commonly used quantifiers
{n,}//at least n times, Maximum unlimited
*//any time
?//0 or one time
+//once or any time
(9)
.------>\.
(10)
Re =//i
Re.test (char)//Verify that char is not in accordance with the re//feature meets the requirements, true
^ Beginning of the line
$ End of line

JavaScript essay 8

Related Article

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.