Your SlideShare is downloading. ×
The Power of Regular Expression: use in notepad++
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

The Power of Regular Expression: use in notepad++

235,108

Published on

Published in: Technology, Business
12 Comments
19 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
235,108
On Slideshare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
985
Comments
12
Likes
19
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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. Alert
    • Don’t expect to master regular expressions (regex) in this short presentation.
      • This shows how you can exploit regex to make your work a breeze
      • It takes a lot of time and hard work to learn regex
    • You don’t have to be a programmer to master regular expressions, though being a programmer is definitely a plus point
  • 3. Remove numbers from the list of 1000 rows of names
  • 4. Choose “Replace” from “Search” menu
  • 5. You will get a replace dialog box.
  • 6. Type [0-9]* (.*) in find what box, 1 in replace with box. Note: There’s a space between [0-9]* and (.*).
  • 7. Check Regular Expression checkbox to exploit regex functionality.
  • 8. Hurray! Done.
  • 9. A short explanation
    • [0-9]* will match numbers only
      • In our case it matches numbers only
    • .* 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
  • 10. Now you have to swap numbers and names, but separated by comma.
  • 11. Type ( [0-9]*) (.*) in find what box, 2,1 in replace with box.
  • 12. Replaced!
  • 13. 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
  • 14. Now you have to remove numbers, put last-name first, followed by first-name, and separated by comma.
  • 15. Type ( [0-9]*) ([^ ]*) (.*) in find what box, 3,2 in replace with box.
  • 16. Replaced!
  • 17. 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 first-names 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
  • 18. The beginning
    • Make today
    • a noble beginning
    • with The Regular Expressions

×