Notepad++ RegEx Inquiry

5 replies
Hello. I need help in finding the right regex formula using Notepad++'s find & replace feature to trim some data I have.

Here's my problem. I have lines in N++ like this:

</td2898>MONKEY</tfeai35uefd>
</tie1gaod>PENGUIN</tgeo2ad>

I want to manipulate the data so it reads this:

MONKEY
PENGUIN

Does anyone know how? I've been attempting to solve this problem for about 2 hours now with no luck. Any help would be much appreciated.
#inquiry #notepad #regex
  • Profile picture of the author Jezreel Pigott
    If I understand you correctly you should be able to hit CTRL + H then copy paste the tags one by one Into the Find what: field and leave the bottom field blank then click replace all. That should clear them out for you.
    {{ DiscussionBoard.errors[8136443].message }}
  • Profile picture of the author Sweersz
    Thanks for the reply, Proudmoor. You are understanding me correctly, however, in my case I have several thousand lines of code that need this treatment so that would take awhile, haha.
    {{ DiscussionBoard.errors[8136466].message }}
    • Profile picture of the author Brandon Tanner
      I don't know about a regex solution (regex makes my brain hurt, lol), but it's easy to accomplish this using spreadsheet software. I'll use OpenOffice Calc in this example, but I think the process is pretty similar in MS Office.

      First, put your data in a plain text file and then save it with a "csv" extension (ie data.csv).

      Next, open up Calc and load the csv file. You should then see a popup that says "Text Import" with a bunch of different options. In the "Separated by" part, check "other", and then use...

      > <

      ...for the "other" value, then click OK.

      After it loads, simply highlight the desired column, then you can copy and paste it wherever you need to.

      Signature

      {{ DiscussionBoard.errors[8136736].message }}
  • Profile picture of the author BobbyF
    • Choose Search | Replace (or ctrl + H)
    • Find What = [<].*?>
    • Replace = BLANK
    • Search Mode = Regular Expressions

    That worked for me with the data you supplied
    {{ DiscussionBoard.errors[8136859].message }}
    • Profile picture of the author Sweersz
      Thanks for the input, Brandon. I haven't used OpenOffice calc but perhaps I should give it a go.

      BobbyF, that works! MUCH appreciated.

      Thank you, guys.
      {{ DiscussionBoard.errors[8137006].message }}

Trending Topics