Gossamer Forum
Home : General : Perl Programming :

A regular expression for "and"

Quote Reply
A regular expression for "and"
I know that I can use
$string =~ /this|that/;
to find out if either "this" or "that" is in a string. How do I find out if both "this" and "that" is in a string?

------------------
JPD





Quote Reply
Re: A regular expression for "and" In reply to
Best bet is to use two regs:

if (/this/ && /that/) {
.. match
}

Don't think there is a nice way to do it in one reg..

Cheers,

Alex