A look at  the power of  Regular Expressions   for the layman Use in Notepad++ Anjesh Tuladhar http://anjesh.blogspot.com ...
Alert <ul><li>Don’t expect to master regular expressions (regex) in this short presentation.  </li></ul><ul><ul><li>This s...
Remove numbers from the list of 1000 rows of names
Choose “Replace” from “Search” menu
You will get a replace dialog box.
Type  [0-9]* (.*)  in find what box,  1  in replace with box.  Note: There’s a space between [0-9]* and (.*).
Check Regular Expression checkbox to exploit regex functionality.
Hurray! Done.
A short explanation <ul><li>[0-9]*  will match numbers only </li></ul><ul><ul><li>In our case it matches numbers only </li...
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 <ul><li>See previous explanation for [0-9]* and (.*) </li></ul><ul><li>Now enclosing [0-9]* with curve...
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 <ul><li>[0-9]*  will match numbers only </li></ul><ul><li>[^ ]*  will match anything from the current ...
The beginning <ul><li>Make today </li></ul><ul><li>a noble beginning   </li></ul><ul><li>with  The Regular Expressions </l...
Upcoming SlideShare
Loading in …5
×

The Power of Regular Expression: use in notepad++

245,275 views
244,516 views

Published on

Published in: Technology, Business
12 Comments
24 Likes
Statistics
Notes
  • I have found
    ([0-9]+) ([0-9]+).([0-9]+).([0-9]+)
    replace with: \1 \2:\3:\4
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Excuse me, for replace all date for example
    20140312 10.34.22 with 20140312 10:34:22
    20140708 19.20.04 with 20140708 19:20:04
    ...
    Thanks from Italy
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi Craig 68x,
    in 'Find what': (\d{4})\;(\w+.*)\;(\w+.*)
    in 'Replace with' : \1\;\3\;\2
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Excellent, like it!
    I don't quite know why the space char disappears, how to remain space if needs. (e.g. 'A\tb c' ---> 'c b\tA')
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I'm a beta tester for FHM by OOTP, how can I switch the 2 teams but keep the current date format?
    20;1;1995;Toronto Maple Leafs;Los Angeles Kings
    20;1;1995;Buffalo Sabres;New York Rangers

    Obviously the schedule is longer than this but here is a sample.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
245,275
On SlideShare
0
From Embeds
0
Number of Embeds
1,183
Actions
Shares
0
Downloads
1,042
Comments
12
Likes
24
Embeds 0
No embeds

No notes for slide

The Power of Regular Expression: use in notepad++

  1. 1. A look at the power of Regular Expressions for the layman Use in Notepad++ Anjesh Tuladhar http://anjesh.blogspot.com http://just-tech.blogspot.com
  2. 2. Alert <ul><li>Don’t expect to master regular expressions (regex) in this short presentation. </li></ul><ul><ul><li>This shows how you can exploit regex to make your work a breeze </li></ul></ul><ul><ul><li>It takes a lot of time and hard work to learn regex </li></ul></ul><ul><li>You don’t have to be a programmer to master regular expressions, though being a programmer is definitely a plus point </li></ul>
  3. 3. Remove numbers from the list of 1000 rows of names
  4. 4. Choose “Replace” from “Search” menu
  5. 5. You will get a replace dialog box.
  6. 6. Type [0-9]* (.*) in find what box, 1 in replace with box. Note: There’s a space between [0-9]* and (.*).
  7. 7. Check Regular Expression checkbox to exploit regex functionality.
  8. 8. Hurray! Done.
  9. 9. A short explanation <ul><li>[0-9]* will match numbers only </li></ul><ul><ul><li>In our case it matches numbers only </li></ul></ul><ul><li>.* will match any characters, including numbers till the end of the line </li></ul><ul><ul><li>Use of the curve brackets will act as a memory </li></ul></ul><ul><ul><li>Enclosing .* with brackets like (.*) will allow to access it using 1 (see in the replace box) </li></ul></ul><ul><li>The space between [0-9]* and (.*) represents the actual space between numbers and the names in the list </li></ul>
  10. 10. Now you have to swap numbers and names, but separated by comma.
  11. 11. Type ( [0-9]*) (.*) in find what box, 2,1 in replace with box.
  12. 12. Replaced!
  13. 13. A short explanation <ul><li>See previous explanation for [0-9]* and (.*) </li></ul><ul><li>Now enclosing [0-9]* with curve brackets will allow to access it </li></ul><ul><li>First curve bracket can be accessed using 1 and second can be accessed using 2 </li></ul><ul><ul><li>Hence we are swapping the position of names and numbers </li></ul></ul>
  14. 14. Now you have to remove numbers, put last-name first, followed by first-name, and separated by comma.
  15. 15. Type ( [0-9]*) ([^ ]*) (.*) in find what box, 3,2 in replace with box.
  16. 16. Replaced!
  17. 17. A short explanation <ul><li>[0-9]* will match numbers only </li></ul><ul><li>[^ ]* will match anything from the current position till it finds space, which in our case will match the first-names only </li></ul><ul><li>.* will match any character from the current position till the end of the line </li></ul><ul><li>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 </li></ul>
  18. 18. The beginning <ul><li>Make today </li></ul><ul><li>a noble beginning </li></ul><ul><li>with The Regular Expressions </li></ul>

×