sharepoint designer中的正则表达式和其他的正则表达不同,开始的时候很折磨人
例如向后引用的分组使用的是大括号{},而不是括号()。
还有其他的不同,如使用#@等符号,:b表示空格,:d表示数等等。。。。
折磨我的那个替换:
sharepointRegex.png

<table class=FTR_TABLE.*\n(^.*$\n)@</table>
这个是一个处理多行的表达式,使用了\n和@

微软的详细说明地址

EXPRESSION SYNTAX DESCRIPTION
Any character .

Acts as a wild card to match any single printing or non-printing character with the exception of the newline (\n)character.

For example, the regular expression c.t matches the strings cat, c t, cot, but not cost. In this example, the period (.) is a wild card for a single character. It appears between the letters 'c' and 't', so any single character between the characters 'c' and 't' will match the expression — even if it is a space.
Maximal — zero or more *

Matches zero or more occurrences of a character that precede the expression, matching as many characters as possible.

The regular expression .* matches zero or more occurrences of one character.
For example, the regular expression b.*k matches book, back, black, blank, and buck. In this example, we combine the period (.) with the asterisk (*) to make one syntax. The period (.) appears immediately before the asterisk (*) expression. The asterisk (*) matches zero or more occurrences of any character between 'b and 'k'. The period (.) acts as a wild card for the characters between 'b' and 'k'. In this example, it means that any character between 'b' and 'k' can be repeated.
Maximal — one or more +

Matches one or more occurrences of a character that precede the expression, matching as many characters as possible.

The regular expression .+ matches one or more occurrence of one character.
For example, the regular expression bo+. matches bob, book, and boot. In this example, we combine the period (.) with the plus sign (+) to make one syntax. The period (.) appears immediately after the plus sign (+) expression. The plus sign (+) matches one or more occurrences of the letter 'o'. The period (.) acts as a wild card for the last character of each word, which, in this example are 'b', 'k', and 't'.
Minimal — zero or more @

Matches zero or more occurrences of a character that precede the expression, matching as few characters as possible.

The regular expression .@ means match zero or more occurrences of one character.
For example, the regular expression a.@x matches 'abx' within 'abxbxb' and 'acx' within 'acxcxc'. In this example, we combine the period (.) with the at sign (@) to make one syntax. The period (.) appears immediately before the at sign (@) expression. The at sign (@) matches zero or more occurrences of any character between 'a and 'x'. In this example, the period (.) acts as a wild card for the characters 'b' and 'c' between the characters 'a' and 'x'. 
Minimal — one or more #

Matches one or more occurrences of a character that precede the expression, matching as few characters as possible.

For example, the regular expression si.#er matches 'sicker' or 'silkier'. In this example, we combine the period (.) with the sharp sign (#) to make one syntax. The period (.) appears immediately before the sharp sign (#) expression. The sharp sign (#) matches one or more occurrences of any character between 'si' and 'er'. The period (.) acts as a wild card for the characters 'c' and 'k' in the word sicker, and 'l', 'k', and 'i' in the word silkier. 
Set of characters [ ] Matches any one of the characters within the brackets ([ ]). You can specify ranges of characters by using a hyphen (-), as in [a-z].

Examples:

  • The regular expression c[aou]t matches cat, cot, and cut, but not cet or cit.
  • The regular expression [0-9] means match any digit.
  • You can specify multiple ranges of letters as well. The regular expression [A-Za-z] means match all upper and lower case letters.
Beginning of line ^

Anchors the match to the beginning of a line.

For example, the regular expression ^When in matches the any string that begins with "When in" and that also appears at the beginning of a line, such as "When in the course of human events" or "When in town, call me". Whereas, this regular expression does not match "What and when in the course of human events" if it appears at the beginning of a line.
End of line $

Anchors the match to the end of a line.

For example, the regular expression professional$ matches the end of the string "He is a professional" but not the string "They are a group of professionals". 
Beginning of file ^^

Anchors the match to the beginning of a file. Works only when searching for text in source code or in text files.

For example, to match the first HTML tag at the beginning of a file, use the following regular expression: ^^
End of file $$

Anchors the match to the end of a file. Works only when searching for text in source code or in text files.

For example, to match the last HTML tag at the end of a file (with no spaces following the tag), use the following regular expression: $$ 
Or |

Indicates a choice between two items, thereby matching the expression before or after the OR symbol (|).

For example, the regular expression(him|her) matches the following occurrences:
  • "it belongs to him"
  • "it belongs to her"

but it does not match the line "it belongs to them."

Escape special character \

Matches the character following the back slash ( \ ). This allows you to find characters that are used in the regular expression syntax, such as a left curly brace ({) or a caret (^) or some other special character.

For example, you can use \$ to match the dollar sign character ($) rather than implementing the regular expression to 'anchor to end of a line'. Similarly, you can use the expression \. to match the period (.) character rather than match any single character, which is what the period (.) regular expression does.
Tagged expression {}

Tags the text matched by the enclosed expression. You can match another occurrence of the tagged text in a Find expression or insert the tagged text in a Replace expression using \N.

For example, suppose you are looking to find two duplicate, consecutive words. To search, use the following expression: {.#} \1

With the assumption that the consecutive words are separated by a single space, you'll want to add a space between the right curly brace (}) and the back slash ( \ ).

In this example, we combine the sharp sign (#) and the period (.) with the curly braces ({}) to make one syntax. In this expression, .# represents any consecutive characters. Since this portion of the expression is surrounded by curly braces ({}), the consecutive characters will be tagged and can be referred to as \1. This expression will find any consecutive characters followed by a space, followed by those exact same consecutive characters. 
Nth tagged expression \N

In a Find expression, \N matches the text matched by the Nth tagged expression, where N is a number from 1 to 9.

In a Replace expression, \N inserts the text matched by the Nth tagged expression where N is a number from 1 to 9. \0 inserts the text matched by the entire Find expression.

For example, suppose you want to find two duplicate, consecutive words and replace them with a single word. To search, use the following expression: {.#} \l

With the assumption that the consecutive words are separated by a single space, you'll want to add a space between the right curly brace (}) and the back slash ( \ ). In this example, we combined the sharp sign (#) and the period (.) with the curly braces ({}) to make one syntax.

To replace, use the following expression: \l

\1 represents what was found in the first pair of curly braces in the find string. By using \1 in the replace action, you essentially replace the duplicate, consecutive words with a single copy of the word.

Group expression ( )

Marks the beginning and end of a subexpression.

A subexpression is a regular expression that you enclose in parenthesis ( ), such as the expression that follows: (ha)+ In this example, we combine the plus sign (+) with the parenthesis ( ) group expression to make one syntax. The subexpression is (ha) because it is encapsulated within the parenthesis ( ). When you add the plus sign (+), the expression enables you to find repeating pairs of letters. The plus sign (+) represents one or more occurrences of 'ha'. 

This expression matches the following occurrences 'haha' and 'hahaha'.

Prevent match ~x

Prevents a match when x appears at this point in the expression.

For example, the regular expression real~(ity) matches the "real" in "realty" and "really", but prevents the match to "real" in "reality". 
Line break \n

Matches a new line in Code view, or a
in Design view.

The syntax (\n), is a shorthand approach to enable you to match all line breaks.

Tab \t

Matches a single tab character.

For example, if you want to find all single tabbed characters at the beginning of a line, the regular expression would look like the following:

^\t+

In this example, we combine the caret (^) and the plus sign (+) with the tab (\t) to make one syntax. The caret (^) that precedes the single tab character expression, anchors the match to all tabbed characters at the beginning of the line. The plus sign (+) represents the matching of one or more tab characters.

Any one character not in the set [^]

Matches any character that is not in the set of characters that follows the caret (^).

For example, to match any character except those in the range, use the caret (^) as the first character after the opening bracket. The expression [^269A-Z] will match any characters except 2, 6, 9, and any upper case alphabetical characters.
Repeat expression ^n

Matches n occurrences of the expression that precedes the caret (^).

For example, with n equaling 4, the expression [0-9]^4 matches any 4-digit sequence. In this example, we combine the set of characters ([ ]) syntax with the repeat (^n) syntax to demonstrate a more realistic use of regular expressions.
Alphanumeric character :a Matches the expression [a-zA-Z0-9]
You can use the following expression: [a-zA-Z0-9] to match one occurrence of a letter (upper case or lower case) or number. Also known as alphanumeric occurrences. You can use the shorthand expression :a for all instances of [a-zA-Z0-9].
White space :b

Matches any white spaces in code or text.

For example, to match a single white space character at the beginning of a line, use the following regular expression:^:b
Alphabetic character :c Matches the expression [a-zA-Z]When you use this expression, it enables you to match all upper or lower case letters. 
You can use the shorthand expression :c for all instances of [a-zA-Z].
Decimal digit :d Matches the expression[0-9]This expression enables you to match any digit. 
For example, suppose you want to find a social security number in a text file. The format for U.S. social security numbers is 999-99-9999. :d^3-:d^2-:d^4 or, by using [0-9], the same resulting expression:[0-9]^3-[0-9]^2-[0-9]^4]
You can use the shorthand expression :d for all instances of [0-9].
Hexadecimal digit :h Matches the expression [0-9a-fA-F]+

Use a this expression when you want to match a hexadecimal combination of any upper or lower case letters between 'A' and 'F', and any numbers.

For example, suppose the pages in your Web site have multiple different background colors and you want to change the color of those pages to black, such as 000000. However, you do not know what the hexadecimal numbers are for the existing colors. Use the following regular expression to find all existing hexadecimal numbers:

\#:h

You could use [0-9a-fA-F] to search, but in this example we combine the back slash (\) and the sharp sign (#) with the hexadecimal digit (:h) syntax. \# matches a non-expression sharp sign (#) and :h matches any sequence of hexadecimal characters.

To replace the existing hexadecimal numbers, type the hexadecimal number of the background color that you want: 000000
Identifier :i Matches the expression [a-zA-Z_$][a-zA-Z0-9_$]*
When working with code, if you want to match all program identifiers, you can use the shorthand expression :i to replace having to type the lengthy expression above.
Rational number :n Matches the expression ([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)|([0-9]+)
If you want to match all whole numbers that contain a decimal point, you can use the shorthand expression :n to replace having to type the lengthy expression above.
Quoted string :q Matches the expression ("[~"]*")|('[~']*')
If you want to match all quotes surrounded by quotation marks, you can use the shorthand expression :q to replace having to type the lengthy expression above.
Alphabetic string :w Matches the expression [a-zA-Z]+

This syntax is a shorthand approach to enable you to match one or more alphabetical characters, either lower case or upper case.

Decimal integer :z Matches the expression [0-9]+ 

This syntax is a shorthand approach to enable you match any number from zero or more.