search-replace

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Paraic McKenna

search-replace

Post by Paraic McKenna »

I'm sure this is a basic question - I've imported a number of pages from HTM - how do I search for anything that's tagged "<....>" & delete it, bearing in mind that the text within the "<>" brackets varies considerably. I've tried

^<.*>

but this deletes text between tags if there are more than one an a line.

many thanks
Jens Hollmann

Re: search-replace

Post by Jens Hollmann »

That is because ".*" matches a sequence of any character including ">" and Textpads regular expressions are "greedy" per default which means it takes the longest match that is found as the result.

So try something like

<[^>]*>

Which will instead match a sequence of any character except ">" between "<" and ">".

Note that your tags mustn't span multiple lines!

HTH

Jens
Andreas

Re: search-replace

Post by Andreas »

You can't really work on html with regex.

Example:
<img src="dummy.gif" alt="this is an image of an > character" width="bla">
Paraic McKenna

Re: search-replace

Post by Paraic McKenna »

Many thanks to all for your help - actually, I was able to get the solution under the help function:

<[^>]*>

Lessons to learn:
1) RTFM
2) what a great application
Post Reply