Page 1 of 1

How do I search/replace multiline expressions?

Posted: Fri Apr 27, 2001 12:00 pm
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

Re: How do I search/replace multiline expressions?

Posted: Fri Apr 27, 2001 9:42 pm
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

Re: How do I search/replace multiline expressions?

Posted: Sun Apr 29, 2001 6:24 pm
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

Re: How do I search/replace multiline expressions?

Posted: Mon Apr 30, 2001 4:57 am
by Randall McDougall
regexp: \n
replace: %N%
(or something equally find & replaceable later when you want to change it back)