分类: Oracle
2011-08-03 14:55:40
Oracle® Database Application Developer's Guide - Fundamentals 10g Release 2 (10.2)对\n的解释如下: |
\n | Backreference | Matches the nth preceding subexpression, that is, whatever is grouped within parentheses, where n is an integer from 1 to 9. The parentheses cause an expression to be remembered; a backreference refers to it. A backreference counts subexpressions from left to right, starting with the opening parenthesis of each preceding subexpression. The expression is invalid if the source string contains fewer than n subexpressions preceding the \n. Oracle supports the backreference expression in the regular expression pattern and the replacement string of the REGEXP_REPLACE function. | The expression (abc|def)xy\1 matches the stringsabcxyabc and defxydef, but does not matchabcxydef or abcxy. A backreference enables you to search for a repeated string without knowing the actual string ahead of time. For example, the expression^(.*)\1$ matches a line consisting of two adjacent instances of the same string. |