pspad regex replace search

Replace Examples: 

Date format change from dd.mm.yyyy to yyyy-mm-dd. This will turn the European date style 26.8.1994 or 26/8/1994 into 1994-8-26.  

Search: ([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})  

Replace: $3-$2-$1

 

Find Examples: 

(.)\1+         matches 'aaaa' and 'cc'.  

(.+)\1+        also match 'abab' and '123123'  

(['"]?)(\d+)\1 matches '"13" (in double quotes), or '4' (in single quotes) or 77 (without quotes) etc

 

Metacharacters - Subexpressions 

The bracketing construct ( ... ) may also be used to define r.e. subexpressions (after parsing, you can find subexpression positions, lengths and actual values in MatchPos, MatchLen and Match properties of TRegExpr, and substitute it in clip strings by TRegExpr.Substitute).  

Subexpressions are numbered based on the left to right order of their opening parenthesis. First subexpression has number '1' (whole r.e. match has number '0' - You can substitute it in TRegExpr.Substitute as '$0' or '$&').  

Examples: 

(foobar){8,10}        matches strings which contain 8, 9 or 10 instances of the 'foobar'  

foob([0-9]|a+)r       matches 'foob0r', 'foob1r' , 'foobar', 'foobaar', 'foobaar' etc.  

(abc(def)ghi(123))xzy    matches abcdefghi123xyz (the only match),  

Then backreferences:  

\1 = abcdefghi123,  

\2=def,  

\3=123,  

\0=abcdefghi123xyz (the whole match) 

你可能感兴趣的:(replace)