A
Andrew Stewart
Hi,
Please could somebody show me how to write a regular expression that
matches when the input is not blank and it's not a specific word,
e.g. dog.
For example, I would hope for these results:
'' =~ regexp # nil
'dog' =~ regexp # nil
'cat' =~ regexp # not nil
I have tried various permutations and combinations involving (?!re)
but I just can't find the answer. In fact I'm beginning to doubt
that (?!re) works at all on my system (Ruby 1.8.6)...but on balance
it's probably me rather than my Ruby installation!
Thanks and regards,
Andy Stewart
Please could somebody show me how to write a regular expression that
matches when the input is not blank and it's not a specific word,
e.g. dog.
For example, I would hope for these results:
'' =~ regexp # nil
'dog' =~ regexp # nil
'cat' =~ regexp # not nil
I have tried various permutations and combinations involving (?!re)
but I just can't find the answer. In fact I'm beginning to doubt
that (?!re) works at all on my system (Ruby 1.8.6)...but on balance
it's probably me rather than my Ruby installation!
Thanks and regards,
Andy Stewart