The Power of Regular Expression Use in Notepad++
The Power of Regular Expression Use in Notepad++
Use in Notepad++
Alert
You dont have to be a programmer to master regular expressions, though being a programmer is definitely a plus point
Type [0-9]* (.*) in find what box, \1 in replace with box. Note: Theres a space between [0-9]* and (.*).
Hurray! Done.
A short explanation
.* will match any characters, including numbers till the end of the line
Use of the curve brackets will act as a memory Enclosing .* with brackets like (.*) will allow to access it using \1 (see in the replace box)
The space between [0-9]* and (.*) represents the actual space between numbers and the names in the list
Now you have to swap numbers and names, but separated by comma.
Type ([0-9]*) (.*) in find what box, \2,\1 in replace with box.
Replaced!
A short explanation
See previous explanation for [0-9]* and (.*) Now enclosing [0-9]* with curve brackets will allow to access it First curve bracket can be accessed using \1 and second can be accessed using \2
Hence we are swapping the position of names and numbers
Now you have to remove numbers, put last-name first, followed by first-name, and separated by comma.
Type ([0-9]*) ([^ ]*) (.*) in find what box, \3,\2 in replace with box.
Replaced!
A short explanation
[0-9]* will match numbers only [^ ]* will match anything from the current position till it finds space, which in our case will match the firstnames only .* will match any character from the current position till the end of the line Now [0-9]* is accessed using \1, [^ ]* is accessed using \2 and .* is access using \3, since all of those expressions are enclosed with curve brackets
The beginning
Make today
a noble beginning
with The Regular Expressions