[Nottingham] Perl Regular Expression Query.

Michael Erskine nottingham at mailman.lug.org.uk
Fri Jan 17 15:18:00 2003


> -----Original Message-----
> From: peter.chang@nottingham.ac.uk=20
> [mailto:peter.chang@nottingham.ac.uk]=20
> Sent: 17 January 2003 14:12
> To: Nottingham LUG (E-mail)
> Subject: Re: [Nottingham] Perl Regular Expression Query.

> I'm not by any imagination a perl programmer but from what I=20
> know about
> regex, the '?'s are erroneous. You should be using=20
> /@.*@.*@.*@/, in fact
<snip>

With all due respect Peter, Sorry but no!

with /@.*@.*@.*@/, testing...

	'lets try this one@two@three@four@and@some@more@@@'

...results in a match of...

	'@two@three@four@and@some@more@@@'

...which shows that your test only succeeded because your s2p generated
script operated on each line individually which only contained four @
symbols (self fulfilling test method prophecy) -- if, as it appears, the
@ symbols are separators of some sort then the greedy match returns more
separators per match than the specified four.

Regards,

Michael.