Regexp to match a subset of strings but exclude all of a certain character
well, they should always put the carriage returns at the spaces between the
word, so you should be able to do something like this:
strPattern = "user\s+unknown|mailbox\s+not\s+found|mailbox\s+full"
where \s is any whitespace character (space, form-feed, etc.)
-K
Quote:
> Hello All,
> I am trying to write a regular expression which will match any one of
> a subset of strings such as "user unknown|mailbox not found|mailbox
> full" but ignore all occurances of a particular character (such as
> newline or carriage return) in the source string.
> Eg: strPattern = "([^\n\l]+)user unknown|mailbox not found|mailbox
> full"
> This will be used to process NDR emails from a bounce mailbox, but
> some of the search strings may be not match as the NDR email may be
> wrapped by the mail server that sent it, inserting newline/carriage
> return characters at the 80-column mark. If this causes the potential
> search string match to be split over two lines the match fails... so I
> want to have the regexp ignore all CR/LF characters and basically
> treat the whole mail body text (the source string) as one unbroken
> line. I know I could do this in two steps by first doing a replace on
> the source string to remove all CR/LF chars then searching the result
> for the strings but is there a way to do this in the one regexp?
> TIA for your time!
> Regards,
> Jacob