在正则表达式中支持 \K [英] Support of \K in regex

查看:60
本文介绍了在正则表达式中支持 \K的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

\K 转义序列将匹配的开头重置为令牌列表(这仅影响报告为完全匹配的内容).

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).

哪些环境/语言/版本在其正则表达式引擎中支持 \K(保留)以及需要哪些库(如果有)才能在模式中使用此功能?

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?

推荐答案

\K 转义序列受到多种引擎、语言或工具的支持,例如:

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

...并且(到目前为止)不受以下支持:

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

  • .NET
  • awk
  • 重击
  • ICU
  • Java
  • Javascript
  • 目标-C
  • POSIX
  • Python
  • Qt/QRegExp
  • sed
  • Tcl
  • vim       ← 它没有 \K,但它的 \zs 是等效的
  • XML
  • XPath

这篇关于在正则表达式中支持 \K的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆