Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find and replace all occurences of a tag <xyz..ewwef> in a text using Python or Notepad++.

Since I got a lot of data, Python keeps hanging up when I use the regex function, so I'd prefer using Notepad++.

But the < and > seem to mess up the search syntax, so if I try finding all <> plus their content in between using (?=<).*(?=>), Notepad is not able to find any matches.

share|improve this question
Welcome to Super User, Xavier! Check your formatting please. Tags like <> are stripped out from posts for reasons of HTML sanitizing. You need to wrap them in code blocks by using backticks: ` – slhck Jun 14 '12 at 9:56
Thanks for the headsup! will do! – Xavier Jun 14 '12 at 10:05
up vote 2 down vote accepted

Try using [?=<].*[?=>] in notepad++. <.*> also works.

For processing regex on large files in Python, see this answer, and see here, and this answer too.

share|improve this answer
That did the trick. Silly me. Thanks. But now I got a different problem. The text starts with an <I> and ends in </I> so it is about to replace the whole thing :( – Xavier Jun 14 '12 at 10:00
So in this case you do not want to find <> plus their content? See this answer for a link to the HTML Agility pack, for processing these kind of things :) – invert Jun 14 '12 at 10:06
I guess I made it now. I figured out the tags in use and included them specifically into the <>but one argument of them always starts in ICE but is followed to running numbers. What is the most elegant way to match all those <> when content starts in "ICE"? – Xavier Jun 14 '12 at 10:12
<ICE.*> seems to find those cases that starts in "ICE", including the surrounding brackets. – invert Jun 15 '12 at 7:18
For interest, regex questions loosely fall into programming, such Q's go well on stack overflow :) – invert Jun 15 '12 at 7:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.