Sideway
output.to from Sideway
Draft for Information Only

Content

Regular Expression on VWD2010 Express
  ASP Regular Expression
 Regular Expression Examples

Regular Expression on VWD2010 Express

Regular expression can be used on the 'Find and Replace' window of Microsoft visual Web Developer 2010 Express.

ASP Regular Expression

Source/Reference:
https://msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.100).aspx

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.

Symbol Name Description
~ Tilde Match the negation of following expression
@ At Sign Match zero or more of preceding expression minimally
# Number Sign Match one or more of preceding expression minimally
$ Dollar Sign Match end of line test
^ Caret Match beginning of line test in the first character of an expression, or
Match the preceding expression of the following 4-digit times, or
Match the negation of any one character in the set in he first member of character set inside square brackets
* Asterisk Match zero or more of preceding expression
() Parentheses Match as a grouped expression
+ Plus Sign Match one or more of preceding expression
{} Braces Match and tag the grouped expression as a backreference
| Vertical Bar Match the following expression if preceding match is fail
[] Square Brackets Match any one character in the set
\ Backslash Match the following escaped expression
: Colon Match the following shorthand expression
< Less-Than Sign Match beginning of word
> Greater-Than Sign Match end of word
. Full Stop Match any character

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
     

Regular Expression Examples

Simple examples:

  • " *\n *(\n* *)*": to match one or any number of system-independent line break bounded and seperated by zero or more space.
  • "\<(\n|.)*\>": to match a first text "<" and a last text ">" with zero or any number of characters including "\n" and "any character" in between where "\n" allows multiple line matching.
  • "\<(\n|[^\>])*\>": to match a first text "<" and a last text ">" with zero or any number of characters including "\n" and not ">" in between where "\n" allows multiple line matching.
  • "{\<([^%/ \n\>])+}([ |\n]*(\n|[^\>=])*=(("(\n|[^"])*")|('(\n|[^'])*')))*{( /)@\>}": to match an open HTML tag with or without attributes, the open HTML tag without attributes is captured by tagged expression \1\2
  • "{\</([^ \n\>])+}[ |\n]*{\>}": to match a close HTML tag, the close HTML tag is captured by tagged expression \1\2
  • "\<[/]*div[^\>]*\>" to match an specific open or close HTML tag, e.g. div tag
  • "([^\r]|^)\n"
  • "((( )*\n( )*{\n})|((\n( )*){\</})|((^ ( )+){\<})|({[\>|\"| ]}\n ( )+{[a-zA-Z0-9\"\&\*\^\|\%\=\%\@\!\.\•\,\[\]\(]})|(\n( )+{\"}))"  remove space
  • {\<[^/ \>]+[^\>]*\>}(\n| )+{\<[^/ \>]+[^\>]*\>} to remove \n or " " between two tag
  • "^( )*\<{[^ \>]+}\>[\n| ]*\</(\1)\>[\n| ]*";"\1": to match an HTML tag with>
  • "{\<a} [^\>]+{ href="[^"]+"}[^\>]+{\>}" to match an open HTML <a> tag with attributes
  • "{((\<))[^ /\>]+} [^\>]+{\>}": to match an open HTML tag with attributes seperated by a " ". Where the tag name is captured by the first and second {} and is represented by the corresponding \1\2. In other words, all attributes of the HTML tag are removed.
  • "((( )*\n( )*{\n})|((\n( )*){\</})|((^ ( )+){\<})|({[\>|\"]}\n ( )+{[a-zA-Z0-9\"\&\*\^\|\%\=\%\@\!\.\•\,\[\]\(]})|(\n( )+{\"}))":
  • "((( )+<div\>\n( )+<a.+\n.+\n( )+\</div\>\n)|(<div\>\n( )+<a.+\</div\>)|((\n( )*){\</})|((^ ( )+){\<})|(\n ( )+{[a-zA-Z0-9\"]}))": to match four choices and capture three  groups '\1\2\3' only.
  • ((( )*\n( )*{\n})|((\n( )*){\</})|((^ ( )+){\<})|({[\>|\"]}\n ( )+{[a-zA-Z0-9\"\&\*\^\|\%\=\%\@\!\.\,\[\]\(]})|(\n( )+{\"}))
  •   ((( )+<div\>\n( )+<a.+(Top of page).+\n.+\n( )+\</div\>\n)|(\n( )+<a.+\</div\>)|((\n( )*){\</})|((^ ( )+){\<})|({[\>|\"]}\n ( )+{[a-zA-Z0-9\"\&\*\^\|\%\=\%\@\!\.\,\[\]\(]})|(\n( )+{\"}))    \1\2\3\4\5

©sideway

ID: 180100032 Last Updated: 1/31/2018 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339new

Travel 7new

Reference 79

Computer

Hardware 251

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 431

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019