in reply to Re: Regex help
in thread Regex help

I'm confused. Aren't your left and right side zero length assertions:

(?(?=\w)(?<!\w)|(?<!\W))

and

(?(?<=\w)(?!\w)|(?!\W))

just synonymous with \b?

Replies are listed 'Best First'.
Re^3: Regex help
by ysth (Canon) on Jan 15, 2006 at 09:33 UTC
    No, \b says there's a word character on exactly one side, like: (?:(?=\w)(?<!\w)|(?!\w)(?<=\w)).
      Hm, I'd think that

      (?!\w) and (?=\W)

      and also

      (?<=\w) and (?<!\W)

      are equivalent!?

      This would unify your "descripted" \b and japhy's "left side boundary".

      Also, if it ... flies like a duck, quacks like a duck. .. It probably is a duck?!:

      Do I have the wrong test cases?

        (?!\w) and (?=\W) differ at the end of the string.

        (?<=\w) and (?<!\W) differ at the start of the string.