Regular ExpressionsMatch Reset: \K


Remarks

Regex101 defines \K functionality as:

\K resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match

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

  • boost (since ???)
  • grep -P                                                     ← uses PCRE
  • Oniguruma (since 5.13.3)
  • PCRE (since 7.2)
  • Perl (since 5.10.0)
  • PHP (since 5.2.4)
  • Ruby (since 2.0.0)

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

  • .NET
  • awk
  • bash
  • GNU
  • ICU
  • Java
  • Javascript
  • Notepad++
  • Objective-C
  • POSIX
  • Python
  • Qt/QRegExp
  • sed
  • Tcl
  • vim
  • XML
  • XPath