in reply to regex testing for multiple values

I think what all these responses are trying to say is that you want something like:

if ($session->{'usrSystem'} =~ m/(?:(?:SND|ARM|PRO|NOR|IND|) )*/s

The (?: ) just tell the parser to not capture the matched strings (i.e., not to produce the $1.. variables).

I presumed from your version of the Regex that you wanted to match 0 or more occurances of the 3 letter account codes (which was why you put the * in it).

I also presume you meant to have a white-space character (or more specifically a blank) since you put a space between the \ and the "...is that right?

I also presume that you put the /s at the end to treat the string a single line and that . will match embedded newline characters. Is that correct?

ack Albuquerque, NM

Replies are listed 'Best First'.
Re^2: regex testing for multiple values
by grashoper (Monk) on Mar 13, 2008 at 20:08 UTC
    I don't really want the space but your other assumptions are correct,I will try your suggested statement, and post back if I have any further problems. Thank you for the help.