Previous Article Next article
Question reference answer in previous article
First question:
Original question requirement: slightly.
Answer: Right.
Note: The title refers to "some" rather than all of the 18 characters, please follow the second question to understand correctly.
The second question:
The original question requires:
Given string
"Ab Dword1=243[asd\fedsf-]234ff/sdfsf{dkdkd", how to find out all of the regular expression meta-characters.
The answers are as follows:
The metacharacters in the target string has no special meaning and can be placed directly inside the regular expression only if it exists as a normal character, except that the backslash character "\" must be escaped with a backslash. In addition, the left-hand bracket character "]" also needs to be considered, because we need a character class to enumerate these metacharacters, so the left-hand bracket character "]" needs to be handled separately. In addition, the subject also examines the grouping and selection techniques. To integrate the above, we can refer to the following options:
var p=/([[{} ()] *+=/.:\ \^$|])| (])/g; var s= ' ab DWORD1=243[ASD\FEDSF-]234FF/SDFSF{DKDKD '; S.match (P);
|
The new single topic is listed below
(1). Given the regular expression/^ (SE)? [0-9] {12}$/, the string that satisfies this match condition is:
A "123456789123"
B "SI12345678"
C "1234567890"
D "Esx1234567y"
(2). Given regular expressions
/^[0-5]? [0-9]$/, the string that satisfies this match condition is:
A "99"
B "009"
C "0009"
D "10"
Previous Article Next article
This article is from the "Green Peak" blog, please make sure to keep this source http://zhuxianzhong.blog.51cto.com/157061/1691074
Challenge JavaScript Regular Expressions two questions per day (2)