Bob Apthorpe wrote:

Hi,

On Fri, 21 May 2004, Matthias Keller wrote:


Still writing some cool rules for my SA (and if they prove themself
useful hopefully soon for everyone's SA) and I'm trying something like:
match some word and if at some later position there's anything BUT this
word, return true

I'm thinking about something like this:
/([a-z]) [^\1]/i

This should for example match
asdf fdsa
asdf kdkd
asdf asd

but NOT
asdf asdf

Is that possible anyway?



Yes, but with a performance hit. Do you want:

  /([a-z]+)\s+(?!\1\b)/

     matches "asdf fdsa"
     matches "asdf kdkd"
     matches "asdf asd"
doesn't match "asdf asdf"
     matches "asdf asdfg"




Hi Bob

Thanks for the advice.
I found some documentation about it (never seen that ?! before :)  )
BUT my perl seems to refuse those constructs...?
I'm using Version 5.8.1 and when I do something like:
perl -ne "print if /([a-z]+)\s+(?!\1\b)/"
it produces:

bash: !\1\b: event not found

So I guess my perl is too old or something like this??

Matt

Reply via email to