regex to remove NL and CR
| From: | Kathleen Ballard | Date: | Tue, 17 Aug 2004 23:24:26 +0000 |
| Subject: | regex to remove NL and CR | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194106@lists.php.net to get a copy of this message | ||
I am extracting text from a text datatype field of a
database. The target text is marked (beginning and
end) by html comments that have a known--but not
uniform--format. Unfortunately, the web-based
interface used to maintain the data inserted hard line
breaks in the text.
I initially tried removing all NL and CR chars from
the string, which has the unanticipated result of
removing some spaces between words that had wrapped in
the admin interface.
Now, I need to remove all NL and CR that occur within
a string starting with "<!-" and ending with "->". I
have no idea where to start, because the NL and CR
could also occur in the strings that mark the start
and end of the comments.
I am very new to regex, but starting to get it. If
someone could just give me a push in the right
direction. Nothing I have tested in regex coach comes
close to matching what I need.
Kathleen