The checksum is all made up of numbers
Funtin Isigit (s) {var patrn=/^[0-9]{1,20}$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Javasript Form validation mail to determine whether an input is mailbox mail and implemented through regular expressions.
Check Mail mailbox
Funtin Ismail (str) {
var RG =/^ ([a-za-z0-9_-]) +@ ([a-za-z0-9_-]) + ((\.[ a-za-z0-9_-]{2,3}) {1,2}) $/;
Rturn rg.tst (str);
}
Verify Login Name: Can only enter 5-20 letters beginning with a letter, can be with numbers, "_", "." The string
Funtin Isrgistrusrnam (s) {var patrn=/^[a-za-z]{1} ([a-za-z0-9]|[. _]) {4,19}$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Verify user name: You can enter only 1-30 strings that start with a letter
Funtin Istrunam (s) {var patrn=/^[a-za-z]{1,30}$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}}}
Verify password: Can only enter 6-20 letters, numbers, underscores
Funtin ISPASSW (s) {var patrn=/^ (\w) {6,20}$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Check ordinary telephone, fax number: You can "+" start, in addition to numbers, can contain "-"
Funtin Istl (s) {//var patrn=/^[+]{0,1} (\) {1,3}[]? ( [-]? (\) {1,12}) +$/; var patrn=/^[+]{0,1} (\) {1,3}[]? ([-]? ((\)| []) {1,12}) +$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Check mobile phone Number: Must start with a number, in addition to the number, can contain "-"
Funtin Ismbil (s) {var patrn=/^[+]{0,1} (\) {1,3}[]? ( [-]? ((\)| []) {1,12}) +$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Check ZIP code
Funtin Ispstal (s) {//var patrn=/^[a-za-z0-9]{3,12}$/; var patrn=/^[a-za-z0-9]{3,12}$/; if (!patrn.x (s)) Rturn Fals Rturn TRU}
Verify Search Keywords
Funtin Issarh (s) {var patrn=/^[^ ' ~!@#$%^&* () +=|\\\][\]\{\}:; ' \,.<>/?] {1} [^ ' ~!@$%^& () +=|\\\] [\]\{\}:;' \,.<>?] {0,19}$/; if (!patrn.x (s)) Rturn fals Rturn tru} funtin IsIP (s)//by zrgling {var patrn=/^[0-9.] {1,20}$/; if (!patrn.x (s)) Rturn Fals Rturn Tru}
Regular expressions
"^\\+$"
Non-negative integer (positive integer + 0)
"^[0-9]*[1-9][0-9]*$"
Positive integer "^" (-\\+) | ( 0+)) $ "
Non-positive integer (negative integer + 0)
"^-[0-9]*[1-9][0-9]*$"
Negative integer "^-?\\+$"
Integer "^\\+ (\\.\\+)? $"
Non-negative floating-point number (positive floating-point number + 0)
"^ ([0-9]+\\. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\\. [0-9]+) | ([0-9]*[1-9][0-9]*)] $"
Positive floating-point number "^ (-\\+ (\\.\\+)?) | (0+ (\\.0+)) $"
Non-positive floating-point number (negative floating-point number + 0)
^ (-([0-9]+\\. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\\. [0-9]+) | ([0-9]*[1-9][0-9]*))] $"
Negative floating-point numbers
"^(-?\\+)(\\.\\+)?$"
Floating-point number "^[a-za-z]+$"
A string consisting of 26 English letters
"^[a-z]+$"
A string consisting of 26 uppercase letters
"^[a-z]+$"
A string consisting of 26 lowercase letters
"^[a-za-z0-9]+$"
A string consisting of numbers and 26 English letters
"^\\w+$"
A string of numbers, 26 English letters, or underscores
"^[\\w-]+ (\\.[ \\w-]+) *@[\\w-]+ (\\.[ \\w-]+) +$ "
Mail address
"^[a-za-z]+://(\\w+ (-\\w+) *) (\ \\w+ (-\\w+) *)) * (\\?\\s*) $ "
URL "^[a-za-z0-9_]*$"
The use of regular expressions in the detailed
Brief introduction
In short, regular expressions are a powerful tool that can be used for pattern matching and substitution. Its role is as follows:
Tests a pattern of a string.
For example, you can test an input string to see if there is a phone number pattern or a credit card number pattern in the string.
This is known as data validation.
Replaces text. You can use a regular expression in your document to identify specific text, and then you can delete it all, or replace it with another text.
Extracts a substring from a string based on pattern matching. Can be used to find specific text in text or input fields.
Basic syntax
After a preliminary understanding of the function and function of regular expressions, let's take a look at the syntax format of regular expressions.
Regular expressions are generally as follows:
/lv/
The part of the "/" delimiter is the pattern that will be matched in the target object. The user simply puts the pattern content that wants to find the matching object in between the "/" delimiters. Regular expressions provide specialized "meta characters" to enable users to customize schema content more flexibly. The term "metacharacters" refers to those special characters that have special meaning in regular expressions and can be used to specify the mode in which the leading character (that is, the character at the front of the metacharacters) appears in the target object.
The more commonly used meta characters include: "+", "*", and "?".
The "+" metacharacters specify that its leading characters must appear consecutively or repeatedly in the target object.
The "*" Meta character stipulates that its leading characters must appear 0 or more times in the target object.
“?” Metacharacters specify that its leading object must appear 0 or one consecutive times in the target object.
Next, let's look at the specific application of regular expression meta characters.
/f+/because the preceding regular expression contains a "+" metacharacters, it means that a string of one or more letters can be matched with the "FL", "F", or "Ftball" in the target object consecutively after the letter F.
/g*/because the preceding regular expression contains a "*" metacharacters, the representation can match the string of 0 or more letters g that are in the target object, such as "Asy", "G", or "GG", which is followed by a letter.
/wil?/because the above regular expression contains "? The meta character, which indicates that a string of 0 or one letter L can be matched with the "Win" in the target object, or "Wilsn", and so on, after the letter I.
Sometimes you don't know how many characters to match. To accommodate this uncertainty, regular expressions support the concept of qualifiers. These qualifiers can specify how many times a given component of a regular expression must appear to satisfy a match.
{n} n is a non-negative integer. Matches the determined n times. For example, ' {2} ' cannot match ' in Bb ', but can match two of "F".
{N,} n is a non-negative integer. Match at least n times. For example, ' {2,} ' cannot match ' in ' Bb ', but can match all of the ' F '. ' {1,} ' is equivalent to ' + '. ' {0,} ' is equivalent to ' * '.
{n,m} m and n are non-negative integers, where n <= m. Matches n times at least and matches up to M times. For example, "{1,3}" will match the first three in "F". ' {0,1} ' is equivalent to '? '. Notice that there is no space between the comma and the two number.
In addition to metacharacters, users can specify exactly how often a pattern will appear in a matching object. For example,/jim {2,6}/The regular expression above stipulates that the character M can appear consecutively 2-6 times in a matching object, so the regular expression above can match a string such as Jimmy or Jimmmmmy.
After a preliminary understanding of how to use regular expressions, let's look at how other important metacharacters are used.
\s: Used to match a single spaces, includes tab and line breaks; \s: Used to match all characters except a single spaces; \: Used to match numbers from 0 to 9; \w: Used to match letters, numbers, or underscore characters; \w: used to match all characters that do not match the \w;. : Used to match all characters except for line breaks.
(Note: We can think of \s and \s as well as \w and \w as inverse)
Below, let's take a look at how to use the above metacharacters in regular expressions.
/\s+/the above regular expression can be used to match one or more whitespace characters in the target object.
/\000/If we have a complex financial statement in hand, then we can easily find all sums up to thousand dollars through the regular expressions mentioned above.
In addition to the meta characters we have described above, there is another unique special character in the regular expression, that is, the locator. The locator character is used to specify where the match pattern appears in the target object. The more commonly used locator characters include: "^", "$", "\b" and "\b".
The "^" locator stipulates that the match pattern must be present at the beginning of the target string "$" to specify that the match pattern must be present at the end of the target object the "\b" locator stipulates that the matching pattern must now be one of the two boundaries at the beginning or end of the target string "\b" The locators specify that the matching object must be within two boundaries at the beginning and end of the target string, that is, the matching object can neither be the beginning of the target string nor the end of the target string.
Similarly, we can think of "^" and "$" and "\b" and "\b" as two sets of locators that are mutually inverse operations. For example:/^hll/because the above regular expression contains a "^" Locator, you can match a string that starts with "HLL", "HLL", or "Hllhun" in the target object. /ar$/because the above regular expression contains a "$" locator, you can match a string that ends with "ar", "bar", or "AR" in the target object. /\bbm/because the regular expression pattern above starts with the "\b" locator, you can match the string that starts with "BMB" or "BM" in the target object. /man\b/because the above regular expression pattern ends with the "\b" locator, you can match the string that ends with "human", "Wman", or "man" in the target object.
In order to make it easier for users to set a matching pattern, regular expressions allow the user to specify a range in the matching pattern and not be limited to specific characters. For example:
/[a-z]/the above regular expression will match any uppercase letter from a to Z range. /[a-z]/the above regular expression will match any lowercase letter from a to Z range. /[0-9]/the above regular expressions will match any number in the range 0 through 9. /([a-z][a-z][0-9]) +/the above regular expression will match any string of letters and numbers, such as "aB0".
The point to note here is that you can use "()" to group strings together in regular expressions. The "()" symbol contains content that must also appear in the target object. Therefore, the regular expression above will not match a string such as "AB" because the last character in "AB" is a letter rather than a number.
If we want to implement a "or" operation in a regular expression that is similar in programming logic, you can use the pipe character "|" If you choose one of several different modes to match. For example:/t|t|2/The regular expression above will match "T", "T", or "2" in the target object.
There is also a more commonly used operator in the regular expression, that is, the negative character "[^]". Unlike the locator "^" described in the previous article, the negative character "[^]" stipulates that the string specified in the pattern cannot exist in the target object. For example:/[^a-]/the above string will match any character except a,b in the target object. In general, when "^" appears in the "" "is regarded as the negation operator, and when" ^ "is located" ", or No" ", it should be regarded as a locator character.
Finally, the escape character "\" is used when the user needs to add metacharacters to the pattern of regular expressions and find their matching objects. For example:/th\*/the above regular expression will match the target object's "th*" rather than "Th".
After a regular expression is constructed, it can be evaluated like a mathematical expression, that is, it can be evaluated from left to right and in order of precedence. Priority is as follows:
1. \ escape Character 2. (), (?:), (? =), parentheses and square brackets 3. *, +,?, {n}, {n,}, {n,m} qualifier 4. ^, $, \anymtaharatr position and order 5.| " or the action
Working with instances
The Javasript 1.2 has a powerful RGXP () object that can be used to match regular expressions. The TST () method can verify that the target object contains a matching pattern and return Tru or Fals accordingly.
We can use Javasript to write the following script to verify the validity of the email address entered by the user.
Regular Expression Object
This object contains regular expression patterns and flags that indicate how patterns are applied.
Syntax 1 r =/pattrn/[flags] Syntax 2 r = NW RGXP ("Pattrn", ["flags"])
Parameters
R
Required option. The name of the variable that will be assigned the regular expression pattern.
Pattrn
Required option. The regular expression pattern to use. If Syntax 1 is used, the pattern is separated by the "/" character. If you use Syntax 2, enclose the pattern in quotation marks.
Flags
Options available. If you use Syntax 2, enclose the flag in quotation marks. Flags can be used in combination, available in:
G (all pattrn that appear in Full-text lookup) I (Ignore case) m (multiple-line lookup)
Example
The following example creates an object (r) that contains a regular expression pattern and associated flags to show you the use of the regular Expression object. In this case, the regular expression as the result
Object is also used in the math method:
Funtin Mathm () {var r, R;//declaring variable. var s = "th rain in Spain falls mainly in th plain"; R = NW Rgxp ("Ain", "G"); Creates a regular expression object. R = S.math (r); Finds a match in the string s. Rturn (R); }
return value: ain,ain,ain,ain\\
Property Lastinx Properties | Sur properties \
Method Mpil Method | X Method | TSt method \
Request Version 3\\
See RGXP Objects | Regular expression Syntax | String object \ \
X method
Runs a lookup in a string with a regular expression pattern and returns an array that contains the result of the lookup.
rgxp.x (str)
Parameters
Rgxp
Required option. A regular expression object that contains the regular expression pattern and the available flags.
Str
Required option. The string object or string literal in which to perform the lookup.
Description \
If the X method does not find a match, it returns NULL. If it finds a match, the X method returns an array and updates the properties of the global Rgxp object to reflect the result of the match. The 0 elements of the array contain a complete match, and the 1th to n element contains any of the child matches that appear in the match. This is equivalent to not having the math method set global flag (g).
If the global flag is set for a regular expression, X starts looking at the position indicated by the value of Lastinx. If the global flag is not set, X ignores the Lastinx value and starts the search from the beginning of the string.
The array returned by the X method has three properties, namely, input, Inx, and Lastinx. The Input property contains the entire string being looked up. The Inx property contains the location of the entire substring to be matched in the lookup string. The Lastinx property contains the next position of the last character in the match.
Example \
The following example illustrates the use of the X method:
Funtin rgxptst () {var VR = NUMBR (Sriptnginmajrvrsin () + "." + Sriptnginminrvrsin ()) if (VR >= 5.5) {
Test the Jsript version.
var sr = "Th rain in Spain falls mainly in th plain."; var r =/\w+/g;
Creates a regular expression pattern.
var arr; Whil ((arr = r.x (sr))!= null) Umnt.writ (Arr.inx + "-" + Arr.lastinx + arr + "T"); } ls{ALRT ("Please use an updated version of Jsript");}
return value: 0-3th 4-8rain 9-11in 12-17spain 18-23falls 24-30mainly 31-33in 34-37th
TSt Method
\ \ \ Returns a Blan value that indicates whether the pattern exists in the string being searched.
RGXP.TST (str)
Parameters \ \
Rgxp
Required option. A regular expression object that contains the regular expression pattern or the available flags.
Str
Required option. The string on which to test the lookup.
Description
The TST method checks whether a pattern exists in the string, returns TRU if it exists, or returns Fals.
The properties of the global Rgxp object are not modified by the TST method.
Example
The following example illustrates the use of the TST method:
Funtin Tstm (R, s) {var S1;//DECLARE variable.
Checks for the existence of a regular expression for a string.
if (R.TST (s))
Whether the test exists.
S1 = "Ntains";
s contains mode. ls S1 = "s NT Ntain";
s does not contain a pattern. Rturn ("" + S + "'" + S1 + "" "+ R.sur +" ");
Returns a string. }
Function call: Umnt.writ (tstm (/ain+/, "th rain in the Spain falls mainly in Th Plain."));
return value: ' Th rain in Spain falls mainly in th plain. ' Ntains ' ain+ '
Math method
Performs a lookup on a string using the regular expression pattern and returns the result that contains the lookup as an array.
\\stringbj.math (RGXP)
Parameters
\\STRINGBJ required option. A string object or string literal to find it.
Rgxp
Required option. Is the regular expression object that contains the regular expression pattern and the available flags. It can also be a variable name or string literal that contains the regular expression pattern and the available flags.
Description
\ \ If the math method does not find a match, return null. If a match is found to return an array and the properties of the global Rgxp object are updated to reflect the result of the match.
The math method returns an array with three properties: input, Inx, and Lastinx. The Input property contains the entire lookup string. The Inx property contains the position of the substring that matches the entire lookup string. The Lastinx property contains the next position of the last character in the last match.
If the global flag (g) is not set, the 0 element of the array contains the entire match, and the 1th to n element contains the any match that occurred in the match. This is equivalent to an X method that does not have a global flag set. If the global flag is set, element 0 to n contains all matches.
Example
\ The following example shows the use of the math method:
Funtin Mathm () {var r, R;//declaring variable.
var s = "th rain in Spain falls mainly in th plain"; R =/ain/i; Creates a regular expression pattern. R = S.math (r);
Try to match the search string. Rturn (R);
Return to the place where "Ain" first appeared. }
return value: Ain
This example shows the use of the math method with the G flag setting.
Funtin Mathm () {var r, R;//declaring variable.
var s = "th rain in Spain falls mainly in th plain"; R =/ain/ig;
Creates a regular expression pattern. R = S.math (r);
Try to match the search string. Rturn (R);
The returned array contains four matches for all "ain"//occurrences. }
return value: Ain,ain,ain,ain
The previous lines of code illustrate the use of the math method for string literals.
var r, r = "Spain"; r = "Th Rain in Spain". Rpla (R, "Anaa"); Rturn R;
Return value: Th rain in Anaa
Sarh method
Returns the position of the first substring that matches the lookup content of the regular expression.
Stringbj.sarh (RGXP)
Parameters
\\stringbj
Required option. The string object or string literal to find on.
Rgxp
Required option. A regular expression object that contains the regular expression pattern and the available flags.
Description
The Sarh method indicates whether a corresponding match exists. If a match is found, the Sarh method returns an integer value indicating the offset from the start of the matching distance string. If no match is found, return-1.
Example \
The following example shows the use of the Sarh method.
Funtin Sarhm () {var r, R;//declaring variable. var s = "th rain in Spain falls mainly in th plain." R =/falls/i; Creates a regular expression pattern. R = S.sarh (r); Find the string. Rturn (R); Returns the Blan result. }
return value: 18
Regular expression syntax
A regular expression is a literal pattern consisting of ordinary characters (such as characters A through Z) and special characters (called metacharacters). This pattern describes one or more strings to be matched when looking for a text body. A regular expression is used as a template to match a character pattern with the string being searched for.
Here are some examples of regular expressions that you might encounter:
Jsript vbsript matching/^\[\t]*$/"^\[\t]*$" matches a blank line. /\{2}-\{5}/"\{2}-\{5}" verifies that an I number consists of a 2-digit number, a hyphen, and a 5-digit number. /< (. *) >.*<\/\1>/"< (. *) >.*<\/\1>" matches an HTML tag.
The following table is a complete list of metacharacters and its behavior in the context of regular expressions:
Character description
\ marks the next character as a special character, or a literal character, or a back reference, or a octal escape character. For example, ' n ' matches the character ' n '. ' \ n ' matches a newline character. The sequence ' \ \ ' matches ' and ' \ ("matches" ().
^ matches the start position of the input string. If the Multilin property of the Rgxp object is set, ^ also matches the position after ' \ n ' or ' \ R '.
$ matches the end position of the input string. If the Multilin property of the Rgxp object is set, the $ also matches the position before ' \ n ' or ' \ R '.
* Match the preceding subexpression 0 or more times. For example, z* can match "z" and "Z". * is equivalent to {0,}.
+ matches the preceding subexpression one or more times. For example, ' z+ ' can match "z" and "Z", but cannot match "Z". + is equivalent to {1,}.
? Match the preceding subexpression 0 times or once. For example, "(s)?" can match "" or "" in "s".? is equivalent to {0,1}.
{n} n is a non-negative integer. Matches the determined n times. For example, ' {2} ' cannot match ' in Bb ', but can match two of "F".
{N,} n is a non-negative integer. Match at least n times. For example, ' {2,} ' cannot match ' in ' Bb ', but can match all of the ' F '. ' {1,} ' is equivalent to ' + '. ' {0,} ' is equivalent to ' * '.
{n,m} m and n are non-negative integers, where n <= m. Matches n times at least and matches up to M times. Liu, "{1,3}" will match the top three in "F". ' {0,1} ' is equivalent to '? '. Notice that there is no space between the comma and the two number.
? When the character is immediately following any of the other qualifiers (*, +,?, {n}, {n,}, {n,m}), the matching pattern is not greedy. Non-greedy patterns match as few strings as possible, while the default greedy pattern matches as many of the searched strings as possible. For example, for the string "", ' +? ' will match a single "", and ' + ' will match all '.
. Matches any single character except "\ n". To match any character including ' \ n ', use a pattern like ' [. \ n] '.
(PATTRN) matches the pattrn and gets the match. The obtained matches can be obtained from the generated maths collection, the Submaths collection is used in the Vbsript, and the $0...$9 attribute is used in Jsript. To match the parentheses character, use ' \ (' or ' \ ').
(?:p attrn) matches pattrn without obtaining a matching result, which means that this is a non fetch match and is not stored for later use. This is useful for combining parts of a pattern with the "or" character (|). For example, ' Inustr (?: Y|is) is a more abbreviated expression than ' Inustry|inustris '.
(? =pattrn) forward lookup, matching the find string at the beginning of any matching pattrn string. This is a non-fetch match, that is, the match does not need to be acquired for later use. For example, ' Winws (? =95|98| nt|2000) ' Can match "winws" in "Winws 2000", but cannot match "winws" in "WINWS 3.1". It does not consume characters, that is, after a match occurs, the next matching search begins immediately after the last match, instead of starting after the character that contains the pre-check.
(?! PATTRN) to match the lookup string at the beginning of any mismatched ngativ lkaha maths th Sarh string at any pint whr a string nt mathing pattrn. This is a non-fetch match, that is, the match does not need to be acquired for later use. For example ' WINWS (?! 95|98| nt|2000) ' Can match "winws" in "WINWS 3.1", but cannot match "winws" in "WINWS 2000". It does not consume characters, that is, after a match occurs, the next matching search begins immediately after the last match, instead of starting after the character that contains the pre-check.
X|y matches x or Y. For example, ' z|f ' can match "z" or "F". ' (z|f) ' matches "z" or "F".
[XYZ] Character set combination. Matches any one of the characters contained. For example, ' [AB] ' can match ' a ' in ' plain '.
[^XYZ] Negative character set combination. Matches any characters that are not included. For example, ' [^ab] ' can match ' P ' in ' plain '.
[A-z] character range. Matches any character within the specified range. For example, ' [A-z] ' can match any lowercase alphabetic character in the range ' a ' to ' Z '.
[^a-z] a negative character range. Matches any character that is not in the specified range. For example, ' [^a-z] ' can match any character that is not in the range of ' a ' to ' Z '.
\b Matches a word boundary, which refers to the position between the word and the space. For example, ' r\b ' can match ' r ' in ' NVR ', but cannot match ' r ' in ' Vrb '.
\b Matches a non word boundary. ' r\b ' can match ' r ' in ' Vrb ', but cannot match ' r ' in ' NVR '.
\x matches the control characters indicated by X. For example, \m matches a ntrl-m or carriage return character. The value of x must be one-a-Z or a-Z. Otherwise, it will be treated as a literal ' character '.
\ matches a numeric character. equivalent to [0-9].
\ matches a non-numeric character. equivalent to [^0-9].
\f matches a page feed character. Equivalent to \x0 and \l.
\ n matches a newline character. Equivalent to \x0a and \j.
\ r matches a carriage return character. Equivalent to \x0 and \m.
\s matches any white space character, including spaces, tabs, page breaks, and so on. equivalent to [\f\n\r\t\v].
\s matches any non-white-space character. equivalent to [^ \f\n\r\t\v].
\ t matches a tab character. Equivalent to \x09 and \i.
\v matches a vertical tab. Equivalent to \x0b and \k.
\w matches any word character that includes an underscore. Equivalent to ' [a-za-z0-9_] '.
\w matches any non word character. Equivalent to ' [^a-za-z0-9_] '.
\XN matches N, where n is the hexadecimal escape value. The hexadecimal escape value must be a determined two digits long. For example, ' \x41 ' matches ' A '. ' \x041 ' is equivalent to ' \x04 ' & ' 1 '. ASII encoding can be used in regular expressions ...
\num matches num, where num is a positive integer. A reference to the match that was obtained. For example, ' (.) \1 ' matches two consecutive identical characters.
\ n identifies a octal escape value or a back reference. N is a back reference if you have at least N obtained subexpression before. Otherwise, if n is an octal number (0-7), then N is an octal escape value.
\NM identifies a octal escape value or a back reference. NM is a back-to reference if there are at least the \nm before the ' PR by ' in last nm to get the subexpression. If there are at least N fetches before \nm, then N is a back reference followed by a literal m. If all the preceding conditions are not satisfied, if both N and M are octal digits (0-7), then \nm will match octal escape value nm.
\NML if n is an octal number (0-3) and both M and L are octal digits (0-7), then the octal escape value NML is matched.
\un matches N, where N is a Uni character expressed in four hexadecimal digits. For example, \u00a9 matches the copyright symbol (?).
Priority order
After a regular expression is constructed, it can be evaluated like a mathematical expression, that is, it can be evaluated from left to right and in a priority order.
The following table lists the order of precedence for various regular expression operators from highest priority to lowest priority:
Operator description \ Escape character (), (?:), (? =), parentheses and brackets *, +,?, {n}, {n,}, {n,m} qualifier ^, $, \anymtaharatr position and order | "or" action
Ordinary characters
Normal characters are made up of all print and nonprinting characters that are not explicitly specified as metacharacters. This includes all uppercase and lowercase alphabetic characters, all numbers, all punctuation marks, and some symbols.
The simplest regular expression is a single ordinary character that matches the character itself in the searched string. For example, the single character pattern ' a ' can match the letter ' a ' that appears anywhere in the searched string. Here are some examples of word single-character patterns:
/a//7//m/
The equivalent Vbsript-word single-character expression is:
"A" "7" "M"
You can combine multiple single characters together to get a larger expression. For example, the following jsript regular expression is nothing more than an expression created by combining single character expressions ' A ', ' 7 ', and ' M '.
/a7m/
An equivalent vbsript expression is:
"A7m"
Please note that there are no connection operators here. All you have to do is put one character behind another character.