I really had trouble with negation too. It looks like the
characters
in between emacs and Mozilla Firefox are giving you trouble.
Try this
pattern and see if it works:
emacs(?!([s]?Mozilla Firefox))
Of course this will only work if there is either one or no
spaces
between "Mozilla Firefox" and "emacs".
It really helps if you have a tool that lets you test your
patterns
against text blocks. I've seen some mentioned in the posts
in this
group, but I can't remember any off the top of my head.
On Mar 19, 12:05 pm, "dataangel" <k04j... gmail.com> wrote:
> I'm trying to write a regex that matches for
"emacs" but only when not
> followed by "Mozilla Firefox". This is what I
came up with:
>
> emacs(?!.*(Mozilla Firefox))
>
> But that didn't work. I also tried
>
> emacs.*(?!(Mozilla Firefox))
>
> But that didn't work either. Same with:
>
> emacs(?!((Mozilla Firefox)$))
>
> What's the right way to do this? :P
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regex googlegroups.com
To unsubscribe from this group, send email to
regex-unsubscribe googlegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---
|