Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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
add comment

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

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.