Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    The implementations (tested sed and GNU sed on OpenBSD) seem to ignore "If the containing subexpression does not match, or if there is no match for the contained subexpression within the string matched by the containing subexpression, then back-reference expressions corresponding to the contained subexpression shall not match". Because with \1 = a (note: not ab) and \2 = b, how can \(a\(b\)*\)*\2 match abab when "there is no match for the contained subexpression within the string matched by the containing subexpression"? Commented 6 hours ago
  • 2
    That text was suggested in 2004 by Glenn Fowler from AT&T Labs Research, and you can see it doesn't match in ksh93 that still uses their regex implementation. Commented 4 hours ago
  • 1
    (see: re='\(a\(b\)*\)*\2' string=abab ksh93 -c '[[ $string = ~(G)$re ]]'; G for BRE) Commented 4 hours ago
  • BTW the links to the js regex library at becke.ch seem to be broken. Commented 2 hours ago