Regular expression can be used on the 'Find and Replace' window of Microsoft visual Web Developer 2010 Express.
Regular expression literal used on Microsoft visual Web Developer 2010 Express.
Printable Literals |
Description |
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
to match alphabetical and numerical character literally and accordingly. |
! |
to match literal Exclamation mark, !. |
% |
to match literal Percent Sign, %. |
& |
to match literal Ampersand, &. |
_ |
to match literal Underscore, _. |
` |
to match literal Grave Accent, `. |
- |
to match literal Hyphen, -. |
= |
to match literal Equals Sign, =. |
" |
to match literal Quotation Mark, ". |
; |
to match literal Semicolon, ;. |
' |
to match literal Apostrophe, '. |
? |
to match literal Question Mark, ?. |
, |
to match literal Comma, ,. |
/ |
to match literal Slash, /. |
|
to match literal Space, . |
Regular expression control used on Microsoft visual Web Developer 2010 Express.
Regular expression syntax used on Microsoft visual Web Developer 2010 Express.
Syntax |
Description |
Example |
. |
to match any single character except a line break. |
a.o matches "aro" in "around" and "abo" in "about" but not "acro" in "across". |
* |
to match all possible zero or more times of the preceding expression. |
a*b matches "b" in "bat" and "ab" in "about".
e.*e matches the word "enterprise". |
+ |
to match all possible one or more times of the preceding expression. |
ac+ matches words that contain the letter "a" and at least one instance of "c", such as "race", and "ace".
a.+s matches the word "access". |
@ |
to match only minium zero or more times of the preceding expression. |
e.@e matches "ente" and "erprise" in "enterprise", but not the full word "enterprise". |
# |
to match only minium one or more times of the preceding expression. |
ac# matches words that contain the letter "a" and at least one instance of "c", such as "ace".
a.#s matches "acces" in the word "access". |
^ |
to match the beginning of a line. |
^car matches the word "car" only when it appears as the first set of characters in a line of the editor. |
$ |
to match the end of a line. |
end$ matches the word "end" only when it appears as the last set of characters possible at the end of a line in the editor. |
< |
to match the beginning of a word. Only the set [a-zA-Z0-9_] is considered to be characters of a word, while other characters are treated as a word separator. |
<in matches words such as "inside" and "into" that begin with the letters "in". |
> |
to match the end of a word. |
ss> matches words such as "across" and "loss" that end with the letters "ss". |
|
|
|
[] |
to match any one of characters in the set []. To specify a range of characters, list the starting and ending characters separated by a dash (-), as in [a-z]. |
be[n-t] matches "bet" in "between", "ben" in "beneath", and "bes" in "beside" but not "bel" in "below". |
[^...] |
to match any character that is not in the set [] that follows the ^ character. |
be[^n-t] matches "bef" in "before", "beh" in "behind", and "bel" in "below", but not "ben" in "beneath". |
~(X) |
Prevents a match when X appears at this point in the expression.
|
real~(ity) matches the "real" in "realty" and "really," but not the "real" in "reality." It also matches the second "real" (but not the first "real" in "realityreal". |
^n |
Matches n occurrences of the preceding expression.
|
[0-9]^4 matches any 4-digit sequence. |
|
|
|
| |
to match either the expression before or after the OR symbol (|). |
(sponge|mud) bath matches "sponge bath" and "mud bath." |
\ |
to match the character that follows the backslash (\) as a literal. |
\^ searches for the ^ character. |
\n |
to match an operating system-independent line break. In a Replace expression, inserts a line break. |
End\nBegin matches the word "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.
In a Replace expression,
Begin\nEnd replaces the word "End" with "Begin" on the first line, inserts a line break, and then replaces the word "Begin" with the word "End". |
\e |
Unicode U+001B or Escape |
Matches the "Escape" control character. |
\g |
Unicode U+0007 or Bell |
Matches the "Bell" control character. |
\h |
Unicode U+0008 or Backspace |
Matches the "Backspace" control character. |
\t |
Unicode U+0009 or Tab |
Matches a tab character. |
\x#### or \u#### |
Matches a Unicode character given by Unicode value where #### is hexadecimal digits. You can specify a character that is outside the Basic Multilingual Plane (that is, a surrogate) with the ISO 10646 code point or with two Unicode code points that give the values of the surrogate pair. |
\u0065 matches the character "e". |
|
|
|
\1,...,\9 |
In a Find or Replace expression, indicates the text that is matched by the nth tagged expression, where n is a number from 1 to 9.
In a Replace expression, \0 inserts the complete matched text. |
If you search for a{[0-9]} and replace with \1, all occurrences of "a" followed by a digit are replaced by the digit it follows. For example, "a1" is replaced by "1" and similarly "a2" is replaced by "2". |
\(w,n) |
In a Replace expression, right-justifies the nth tagged expression in a field at least w characters wide. |
If you search for a{[0-9]} and replace with \(10,1), the occurrences of "an" are replaced by the integer and right-justified by 10 spaces. |
\(-w,n) |
In a Replace expression, left-justifies the nth tagged expression in a field at least w characters wide. |
If you search for a{[0-9]} and replace with \(-10,1), the occurrences of "an" are replaced by the integer and left-justified by 10 spaces. |
|
|
|
{} |
to use the match that is inside the braces to identify locations where text is to be replaced.
Tagged expression (or backreference) |
{does}n't identifies the text that precedes the replacement in the replace string \1 not to change every occurrence of doesn't to does not. |
() |
Lets you group a set of expressions together, for example to apply a quantifier (* or +).
Grouping |
If you want to search for one or more occurrences of "az", use (az)+. |
|
|
|
:i |
to match any possible C/C++ identifier. Shorthand for the expression ([a-zA-Z_$][a-zA-Z0-9_$]*). |
Matches any possible C/C++ identifier. |
:q |
to match the double or single quotation marks and all enclosed characters.
Shorthand for the expression (("[^"]*")|('[^']*')).
Quoted string |
:q matches "test quote" and 'test quote' but not the 't of can't. |
:b |
to match either space or tab character. Shorthand for the expression ( )#. |
Public:bInterface matches the phrase "Public Interface" in text.
|
:z |
to match characters of any integer. Shorthand for the expression ([0-9]+) |
Matches any integer, such as "1", "234", "56", and so on. |
:a |
Matches the expression ([a-zA-Z0-9]). Alphanumeric character |
Matches any alphanumeric character, such as "a", "A", "w", "W", "5", and so on. |
:c |
Matches the expression ([a-zA-Z]). Alphabetic character |
Matches any alphabetical character, such as "a", "A", "w", "W", and so on. |
:d |
Matches the expression ([0-9]). Decimal digit |
Matches any digit, such as "4" and "6". |
:h |
Matches the expression ([0-9a-fA-F]+). Hexadecimal digit |
Matches any hexadecimal number, such as "1A", "ef", and "007". |
:n |
Matches the expression (([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+)). Rational number |
Matches any rational number, such as "2007", "1.0", and ".9". |
:w |
Matches the expression ([a-zA-Z]+). Alphabetic string |
Matches any string that contains only alphabetical characters. |
:Lu |
Matches any one uppercase letter.
For example:
:Luhe matches "The" but not "the". Uppercase letter |
|
:Ll |
Matches any one lowercase letter.
For example:
:Llhe matches "the" but not "The". Lowercase letter |
|
:Lt |
Matches characters that combine an uppercase letter with a lowercase letter, for example, Nj and Dz. Title case letter |
|
:Lm |
Matches letters or punctuation, such as commas, cross accents, and double prime, that are used to indicate modifications to the preceding letter. Modifier letter |
|
:Lo |
Matches other letters, such as gothic letter ahsa. Other letter |
|
:Nd |
Matches decimal digits, such as 0-9 and their full-width equivalents. Decimal digit |
|
:Nl |
Matches letter digits, such as roman numerals and ideographic number zero. Letter digit |
|
:No |
Matches other digits, such as old italic number one. Other digit |
|
:Ps |
Matches opening punctuation, such as open brackets and braces. Open punctuation |
|
:Pe |
Matches closing punctuation, such as closing brackets and braces. Close punctuation |
|
:Pi |
Matches initial double quotation marks. Initial quote punctuation |
|
:Pf |
Matches single quotation marks and ending double quotation marks. Final quote punctuation |
|
:Pd |
Matches the dash mark. Dash punctuation |
|
:Pc |
Matches the underscore or underline mark. Connector punctuation |
|
:Po |
Matches (,), ?, ", !, @, #, %, &, *, \, (:), (;), ', and /. Other punctuation |
|
:Zs |
Matches blanks. Space separator |
|
:Zl |
Matches the Unicode character U+2028. Line separator |
|
:Zp |
Matches the Unicode character U+2029. Paragraph separator |
|
:Mn |
Matches non-spacing marks. Non-spacing mark |
|
:Mc |
Matches combining marks. Combining mark |
|
:Me |
Matches enclosing marks. Enclosing mark |
|
:Sm |
Matches +, =, ~, |, <, and >. Math symbol |
|
:Sc |
Matches $ and other currency symbols.
Currency symbol |
|
:Sk |
Matches modifier symbols, such as circumflex accent, grave accent, and macron. Modifier symbol |
|
:So |
Matches other symbols, such as the copyright sign, pilcrow sign, and the degree sign. Other symbol |
|
:Cc |
Matches Unicode control characters such as TAB and NEWLINE. Other control |
|
:Cf |
Formatting control character, such as the bi-directional control characters. Other format |
|
:Cs |
Matches half of a surrogate pair. Surrogate |
|
:Co |
Matches any character from the private-use area. Other private-use |
|
:Cn |
Matches characters that do not map to a Unicode character. Other not assigned |
|
:Al |
Matches any one character.
For example, :Alhe matches words such as "The", "then", and "reached". Alpha |
|
:Nu |
Matches any one number or digit. Numeric |
|
:Pu |
Matches any one punctuation mark, such as ?, @, ', and so on. Punctuation |
|
:Wh |
Matches all kinds of white space, such as publishing and ideographic spaces. White space |
|
:Bi |
Matches characters from right-to-left scripts, such as Arabic and Hebrew. Bidi |
|
:Ha |
Matches Korean Hangul and combining Jamos. Hangul |
|
:Hi |
Matches hiragana characters. Hiragana |
|
:Ka |
Matches katakana characters. Katakana |
|
:Id |
Matches ideographic characters, such as Han and kanji.
Ideographic/Han/Kanji |
|
|
|
|