The Power of Regular Expression: use in notepad++

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

7 comments

Comments 1 - 7 of 7 previous next Post a comment

  • + anjesh Anjesh Tuladhar 11 months ago
    the idea is to get the href part of the a tag
    < a.*href=’([^’]*)’>.*< /a >
    and replace with
    [img]\1[/img]

    for the second one.
    replace
    < a.*href=’((.*/[0-9]*/)([^’]*))’>.*< /a >
    with
    [url=\1]\2[nagy][b]\3[/b][/nagy][/url]

    there should not be space after and before < and >. I put space so that the link doesn’t appear.
  • + proba proba 11 months ago
    I would like to change

    http://PIC.com/123456/pic.jpg
    to
    [img]http://PIC.com/123456/pic.jpg[/img]

    AND

    http://LINK.com/123456/file.part1.rar
    to
    [url=http://LINK.com/123456/file.part1.rar]http://LINK.com/123456/[nagy][b]file.part1.rar[/b][/nagy][/url]



    Any idea would be great.
  • + guest20e333b guest20e333b 11 months ago
    Search -> Replace -> Check Extended
    \r\n <-Replace
  • + guest2775d22 guest2775d22 2 years ago
    I am trying to replace new line with comma. I have some lines say:
    adv
    acb
    nhr

    I want to convert them to:
    adv,acb,nhr

    So I typed \n in Find What field and , in Replace With field. Then ticked Regular Expression. But when I clicked Replace All, 0 tokens get replaced.

    Can anyone help me on this??

    Thanks,
    Rupendra Chulyadyo
  • + guestc935c1 guestc935c1 2 years ago
    Thankyou for the tutorial.. I click on the adsense now
  • + guest1b21b0 guest1b21b0 2 years ago
    Good overview of Regex in Notepad++
  • + guestc4823d guestc4823d 2 years ago
    great example, i am checking it everytime i need it :)
Post a comment
Embed Video
Edit your comment Cancel

Favorites, Groups & Events

The Power of Regular Expression: use in notepad++ - Presentation 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

+ Anjesh TuladharAnjesh Tuladhar, 3 years ago

custom

31460 views, 0 favs, 4 embeds more stats

More info about this document

CC Attribution License

Go to text version

  • Total Views 31460
    • 31450 on SlideShare
    • 10 from embeds
  • Comments 7
  • Favorites 0
  • Downloads 56
Most viewed embeds
  • 5 views on http://anjesh.blogspot.com
  • 2 views on http://www.filescon.com
  • 2 views on http://www.powercram.com
  • 1 views on http://www.filestube.com

more

All embeds
  • 5 views on http://anjesh.blogspot.com
  • 2 views on http://www.filescon.com
  • 2 views on http://www.powercram.com
  • 1 views on http://www.filestube.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories