Notepad++ RegExp Help
Author : Georg Dembowski
Notepad++ RegExp List
Note: In case you have the plugins installed, try CONTROL+R or inthe Menu Plugins ? TextFX Quick - Find/Replace to get a sophisticateddialogue including a drop down for regular expressions and multi linesearch/replace.
In a regular expression, special characters interpreted are:
. | Matches any character |
( | This marks the start of a region for tagging a match; so what‘s inside ( ) you can use in "replace with" using \1, \2 etc. |
) | This marks the end of a tagged region. |
\n | Where n is 1 through 9 refers to the first through ninth tagged region when replacing. For example, if the search string was Fred([1-9])XXX and the replace string was Sam\1YYY , when applied to Fred2XXX this would generate Sam2YYY . |
\< | This matches the start of a word using Scintilla‘s definitions of words. |
\> | This matches the end of a word using Scintilla‘s definition of words. |
\x | This allows you to use a character x that would otherwise have a special meaning. For example, \[ would be interpreted as [ and not as the start of a character set. |
[...] | This indicates a set of characters, for example, [abc] means any of the characters a, b or c. You can also use ranges, for example [a-z] for any lower case character. |
[^...] | The complement of the characters in the set. For example, [^A-Za-z] means any character except an alphabetic character. |
^ | This matches the start of a line (unless used inside a set, see above). |
$ | This matches the end of a line. |
* | This matches 0 or more times. For example, Sa*m matches Sm , Sam , Saam , Saaam and so on. |
+ | This matches 1 or more times. For example, Sa+m matches Sam , Saam , Saaam and so on. |
Notepad++ RegExp Examples
Important== title ==
became = title =
, you‘re done :-)31.12.97
became 97-12-31
and 14.08.05
became 05-08-14
and the IP address 14.13.14.14
did not change, you‘re done :-)dir /b/s>filelist.txt
to the file filelist.txt and want tomake local URLs out of them. file:///
in the beginning of all linesC:\!\aktuell.csv
became file:///C:/!/aktuell.csv
, you‘re done :-)Another Search Replace Example
[Data]
EU AX ALA 248 ?land Islands
EU AL ALB 008 Albania, People‘s Socialist Republic of
AF DZ DZA 012 Algeria, People‘s Democratic Republic of
OC AS ASM 016 American Samoa
EU AD AND 020 Andorra, Principality of
AF AO AGO 024 Angola, Republic of
NA AI AIA 660 Anguilla
AN AQ ATA 010 Antarctica (the territory South of 60 deg S)
NA AG ATG 028 Antigua and Barbuda
SA AR ARG 032 Argentina, Argentine Republic
AS AM ARM 051 Armenia
NA AW ABW 533 Aruba
OC AU AUS 036 Australia, Commonwealth of
[SearchPattern]
([A-Z]+) ([A-Z]+) ([A-Z]+) ([0-9]+) (.*)
[ReplacePattern]
\1,\2,\3,\4,\5
[FinalData]
AS,AF,AFG,004,Afghanistan
EU,AX,ALA,248,?land Islands
EU,AL,ALB,008,Albania, People‘s Socialist Republic of
AF,DZ,DZA,012,Algeria, People‘s Democratic Republic of
OC,AS,ASM,016,American Samoa
EU,AD,AND,020,Andorra, Principality of
AF,AO,AGO,024,Angola, Republic of
NA,AI,AIA,660,Anguilla
AN,AQ,ATA,010,Antarctica (the territory South of 60 deg S)
NA,AG,ATG,028,Antigua and Barbuda
SA,AR,ARG,032,Argentina, Argentine Republic
AS,AM,ARM,051,Armenia
NA,AW,ABW,533,Aruba
OC,AU,AUS,036,Australia, Commonwealth of
联系客服