On Thu, 8 Nov 2001, Louis-Philippe Dextraze wrote: > > > > hi, > I found this example on a regexp guide > (http://etext.lib.virginia.edu/helpsheets/regex.html) > > > /(^To:|^From:)/ > > this matches either TO: or From: > > can I twist this in some way to make it match only when both are there? > > example > > "the dude" > "the cat" > "name your state" > "the name of some dude" > > if (/(the|name/) > { > print "Match"; > } > > > this would match all of the string above. > > how could I but the regexp to match ONLY the strings > that contain both ? as this one > > "the name of some dude"
In your first example, it looks like you might be parsing emails.... So the answer depends on how you are parsing your data. You could do: if (/the/ && /name/) { print "Match\n"; } but that assumes you are parsing the whole email header in one line (or at least the To: & From: fields. Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]