Re: array of regular expressions on a string

2003-08-14 Thread Rob Dixon
Ramprasad wrote: > > I have an array of regular exps of which I want to match any of them > in a string. How can I do this without eval. > > for eg. > > @array = ( > '/^to: myprog/mi', > '/^from: [EMAIL PROTECTED]/mi' > ); > > $STRING = read_mail_header(...); > > > foreach (@array) { >

RE: array of regular expressions on a string

2003-08-14 Thread EUROSPACE SZARINDAR
Hi, Why don't you do like that : @array = ( '^to: myprog', '^from: [EMAIL PROTECTED]' ); $STRING = read_mail_header(...); foreach (@array) { if($STRING=~ /$_/mi ) { # This should work # FOUND . } } or

Re: array of regular expressions on a string

2003-08-14 Thread Ramprasad
Rob Dixon wrote: Ramprasad wrote: I have an array of regular exps of which I want to match any of them in a string. How can I do this without eval. for eg. @array = ( '/^to: myprog/mi', '/^from: [EMAIL PROTECTED]/mi' ); $STRING = read_mail_header(...); foreach (@array) { if($STRING=~

Re: array of regular expressions on a string

2003-08-14 Thread Rob Dixon
Ramprasad wrote: > > This was not cut pasted from my actual code. I cannot paste my 250 > line script here so I just wrote a hapazard relevant replica of what > I did. Fair enough! An even worse problem is where people's company standards prohibit decent coding, but I always bear in mind that what