Re: RegEx: text not inside

"Tim Chase [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2014-08-14 23:01, [email protected] wrote:
> a RegEx, that matches a string, which doesn't include a 2nd string.
> foo-xxx--bar -> no match
> foo-xyx--bar -> match
> It should match, if "foo.+?bar" doesn't contain "xx", something like
> "foo.+(?!xx)bar", but that matches always.

You mention wanting to match, but not what you want to do with the
match.  Just print it?  Extract portions?  Find lines that match and
then perform some other action?

You also write to the sed-users mailing list but your syntax at the
bottom looks like a Perlish regex, so I want to confirm that you're
using sed, not some other program.

In a Perlish, you'd do something like

  foo(?:(?!xx).)*bar

which works at least here in Python (which uses mostly-PCREs)

-tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.