Ωmega
Ωmega

Reputation: 43683

Support of \K in regex

The \K escape sequence resets the beginning of the match to the current position in the token list (this only affects what is reported as the full match).

What environments/languages/versions support \K (keep) in its regular expression engines and what libraries are needed (if any) to use this feature within patterns?

Upvotes: 55

Views: 17583

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185530

The \K escape sequence is supported by several engines, languages or tools, such as:

...and (so far) not supported by:

  • .NET
  • awk
  • bash
  • ICU
  • Java
  • Javascript
  • Objective-C
  • POSIX
  • Python
  • Qt/QRegExp
  • sed
  • Tcl
  • vim --------------------⇢ It doesn't have \K, but its \zs is equivalent
  • XML
  • XPath

Upvotes: 55

Related Questions