Find sample:
{\ [Datamapping \ (\ ": A * \", dbtype. (int32 | string | decimaldatetime) \]}
Match:
[Datamapping ("ID", dbtype. int32)]
[Datamapping ("amount", dbtype. decimal)]
See: http://msdn.microsoft.com/en-us/library/2k3te2cs (vs.80, IDE). aspx
Http://forums.microsoft.com/MSDN/ShowPost.aspx? Postid = 1175272 & siteid = 1
Regular Expressions are a concise and flexible notation for finding and replacing patterns of text. A specific set of regular expressions can be used inFind whatField of the Visual Studio find and replace window.
To enable the use of regular expressions inFind whatFieldQuick Find,Find in files,Quick replace, OrReplace in filesOperations, selectUseOption underFind optionsAnd chooseRegular Expressions.
The triangularExpression BuilderButton next toFind whatField then becomes available. Click this button to display a list of the most commonly used regular expressions. When you choose any item fromExpression Builder, It is inserted intoFind whatString.
Note |
There are syntax differences between the regular expressions that can be used inFind whatStrings and those that are valid in. NET Framework programming. For example, inFind and replace, The braces notation {} is used for tagged expressions. So the expressionZo {1}Matches all occurrencesZoFollowed by the tag 1, as inAlonzo1AndGonzo1. But within the. NET Framework, the notation {} is used for quantifiers. So the expressionZo {1}Matches all occurrencesZFollowed by exactly oneO, As inZoneBut not inZoo. |
Regular Expressions for find and replace
Here are the regular expressions available inExpression Builder.
Expression |
Syntax |
Description |
Any character |
. |
Matches any single character t a line break. |
Zero or more |
* |
Matches zero or more occurrences of the preceding expression, making all possible matches. |
One or more |
+ |
Matches at least one occurrence of the preceding expression. |
Beginning of Line |
^ |
Anchors the match string to the beginning of a line. |
End of line |
$ |
Anchors the match string to the end of a line. |
Beginning of Word |
< |
Matches only when a word begins at this point in the text. |
End of Word |
> |
Matches only when a word ends at this point in the text. |
Line Break |
\ N |
Matches a platform-independent line break. In a replace expression, inserts a line break. |
Any one character in the Set |
[] |
Matches any one of the characters within the []. To specify a range of characters, list the starting and ending character separated by a dash (-), as in [A-Z]. |
Any one character not in the Set |
[^...] |
Matches any character not in the set of characters following the ^. |
Or |
| |
Matches either the expression before or the one after the or symbol (|). Mostly used within a group. For example,(Mongoge | mud) BathMatches "sponge bath" and "mud bath ." |
Escape |
\ |
Matches the character that follows the backslash (\) as a literal. This allows you to find the characters used in regular expression notation, such as {and ^. For example,\ ^Searches for the ^ character. |
Tagged expression |
{} |
Matches text tagged with the enclosed expression. |
C/C ++ identifier |
: I |
Matches the expression ([A-Za-Z _ $] [a-zA-Z0-9 _ $] *). |
Quoted string |
: Q |
Matches the expression ("[^"] * ") | ('[^'] * '). |
Space or tab |
: B |
Matches either space or tab characters. |
Integer |
: Z |
Matches the expression ([0-9] + ). |
The list of all regular expressions that are valid inFindAndReplaceOperations is longer than can be displayed inExpression builder.You can also insert any of the following regular expressions intoFind whatString:
Expression |
Syntax |
Description |
Minimal-zero or more |
@ |
Matches zero or more occurrences of the preceding expression, matching as few characters as possible. |
Minimal-one or more |
# |
Matches one or more occurrences of the preceding expression, matching as few characters as possible. |
Repeat n times |
^ N |
Matches n occurrences of the preceding expression. For example,[0-9] ^ 4Matches any 4-digit sequence. |
Grouping |
() |
Allows you to group A set of expressions together. If you want to search for two different expressions in a single search, you can use the grouping expression to combine them. For example, if you want to search-[A-Z] [1-3]Or-[1-10] [A-Z], You wocould combine them:([A-Z] [1-3]) | ([1-10] [A-Z]). |
Nth tagged text |
\ N |
InFindOrReplaceExpression, indicates the text matched by the nth tagged expression, where n is a number from 1 to 9. In a replace expression, \ 0 inserts the entire matched text. |
Right-justified Field |
\ (W, n) |
In a replace expression, right-justifies the nth tagged expression in a field at least W characters wide. |
Left-justified Field |
\ (-W, n) |
In a replace expression, left-justifies the nth tagged expression in a field at least W characters wide. |
Prevent match |
~ (X) |
Prevents a match when x appears at this point in the expression. For example,Real ~ (Ity)Matches the "real" in "realty" and "Really," but not the "real" in "reality ." |
Alphanumeric character |
: |
Matches the expression ([a-zA-Z0-9]). |
Alphabetic character |
: C |
Matches the expression ([A-Za-Z]). |
Decimal digit |
: D |
Matches the expression ([0-9]). |
Hexadecimal digit |
: H |
Matches the expression ([0-9a-fa-f] + ). |
Rational Number |
: N |
Matches the expression ([0-9] +. [0-9] *) | ([0-9] *. [0-9] +) | ([0-9] + )). |
Alphabetic string |
: W |
Matches the expression ([A-Za-Z] + ). |
Escape |
\ E |
Unicode U + 001b. |
Bell |
\ G |
Unicode U + 0007. |
Backspace |
\ H |
Unicode U + 0008. |
Tab |
\ T |
Matches a Tab character, Unicode U + 0009. |
Unicode Character |
\ X #### or \ U #### |
Matches a character given by Unicode value where ### is hexadecimal digits. you can specify a character outside the basic multilingual plane (that is, a surrogate) with the ISO 10646 code point or with two Unicode code points giving the values of the surrogate pair. |
The following table lists the syntax for matching by standard UNICODE character properties. the two-letter abbreviation is the same as listed in the Unicode character properties database. these may be specified as part of a character set. for example, the expression [: Nd: NL: No] matches any kind of digit.
Expression |
Syntax |
Description |
Uppercase letter |
: Lu |
Matches any one capital letter. For example,: LuheMatches "the" but not "". |
Lowercase letter |
: LL |
Matches any one lower case letter. For example,: LlheMatches "the" but not "". |
Title case letter |
: Lt |
Matches characters that combine an uppercase letter with a lowercase letter, such as NJ and DZ. |
Modifier letter |
: LM |
Matches letters or punctuation, such as commas, cross accents, and double Prime, used to indicate modifications to the preceding letter. |
Other letter |
: Lo |
Matches other letters, such as gothic letter ahsa. |
Decimal digit |
: Nd |
Matches decimal digits such as 0-9 and their full-width equivalents. |
Letter Digit |
: NL |
Matches letter digits such as Roman numerals and Ideographic number zero. |
Other Digit |
: No |
Matches other digits such as old italic number one. |
Open punctuation |
: PS |
Matches opening punctuation such as open brackets and braces. |
Close punctuation |
: PE |
Matches closing punctuation such as closing brackets and braces. |
Initial quote punctuation |
: Pi |
Matches initial double quotation marks. |
Final quote punctuation |
: Pf |
Matches single quotation marks and ending double quotation marks. |
Dash punctuation |
: PD |
Matches the dash mark. |
Connector punctuation |
: PC |
Matches the underscore or underline mark. |
Other punctuation |
: Po |
Matches (,),?, ",!, @, #, %, &, *, \, (:), (;), ', And /. |
Space Separator |
: Zs |
Matches blanks. |
Line Separator |
: ZL |
Matches the Unicode Character U + 2028. |
Paragraph Separator |
: ZP |
Matches the Unicode Character U + 2029. |
Non-spacing mark |
: Mn |
Matches non-spacing marks. |
Combining mark |
: MC |
Matches combining marks. |
Enclosing mark |
: Me |
Matches enclosing marks. |
Math symbol |
: Sm |
Matches +, = ,~, |, <, And>. |
Currency symbol |
: SC |
Matches $ and other currency symbols. |
Modifier symbol |
: SK |
Matches modifier symbols such as circumflex accent, grave accent, and macron. |
Other symbol |
: So |
Matches other symbols, such as the copyright sign, pilcrow sign, and the Degree sign. |
Other Control |
: CC |
Matches Unicode control characters such as tab and newline. |
Other format |
: Cf |
Formatting control character such as the bi-directional control characters. |
Surrogate |
: CS |
Matches one half of a surrogate pair. |
Other private-Use |
: Co |
Matches any character from the private-use area. |
Other not assigned |
: CN |
Matches characters that do not map to a Unicode character. |
In addition to the standard UNICODE character properties, the following additional properties may be specified as part of a character set.
Expression |
Syntax |
Description |
Alpha |
: Al |
Matches any one character. For example,: AlheMatches words such as "the", "then", and "reached ". |
Numeric |
: Nu |
Matches any one number or digit. |
Punctuation |
: PU |
Matches any one punctuation mark, Such ?, @, ', And so on. |
White space |
: Wh |
Matches all types of white space, including publishing and Ideographic spaces. |
Bidi |
: Bi |
Matches characters from right-to-left scripts such as Arabic and Hebrew. |
Hangul |
: Ha |
Matches Korean hangul and combining jamos. |
Hiragana |
: Hi |
Matches hiragana characters. |
Katakana |
: Ka |
Matches katakana characters. |
Ideographic/Han/Kanji |