How do I search/replace multiline expressions?

General questions about using TextPad

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

Post Reply
Vegard

How do I search/replace multiline expressions?

Post by Vegard »

I want to remove tags starting with <span xxx ending with </span> where xxx can be an expression extending over several lines.

I tried to search for: <span\(.\|\n\)*</span>

but alas: The help file says" \n A new line character, for matching expressions that span line boundaries. This cannot be followed by operators '*', '+' or {}.

Can the task be done?

Thanks for any advice,
Vegard
Roy Beatty

Re: How do I search/replace multiline expressions?

Post by Roy Beatty »

Try regex converting \n to a brief string not occurring in the original text. Make your changes. Convert that token string back to \n.

I hope the kludge works for you,

Roy
Vegard

Re: How do I search/replace multiline expressions?

Post by Vegard »

Thanks for advice. I had hoped to achieve this in Textpad, but it seems impossible to replace \n in textpad - or have I overlooked something obvious?
Vegard
Randall McDougall

Re: How do I search/replace multiline expressions?

Post by Randall McDougall »

regexp: \n
replace: %N%
(or something equally find & replaceable later when you want to change it back)
Post Reply