B
bpatton
I'm trying to set up some limitation by using regular expressions
recorded in a hash table.
How do I do an 'and' in regular expressions?
$string = '-Dz=a =Dy=b -Dx=c -Dw=d -Dv=e -Du=f -Dt=g -Ds=h';
For an or I can
$search = '-Dx=(c|g|h)'; # this came from hash value
If ($string =~ /$search/) { # This works fine
....
}
Now how would I do an 'and' in any order
and
V
$search = '-Ds=(a|b|c)&&-Du=(f|g|h)'; # need both -Du and -Ds in any
order
If ($string =~ /$search/) {
....
}
It's probably very simple, just can't twist my mind around it
I can't separate the $search. It must always be a single string.
recorded in a hash table.
How do I do an 'and' in regular expressions?
$string = '-Dz=a =Dy=b -Dx=c -Dw=d -Dv=e -Du=f -Dt=g -Ds=h';
For an or I can
$search = '-Dx=(c|g|h)'; # this came from hash value
If ($string =~ /$search/) { # This works fine
....
}
Now how would I do an 'and' in any order
and
V
$search = '-Ds=(a|b|c)&&-Du=(f|g|h)'; # need both -Du and -Ds in any
order
If ($string =~ /$search/) {
....
}
It's probably very simple, just can't twist my mind around it
I can't separate the $search. It must always be a single string.