[英]Regex match digits with lookahead
I have a regex:我有一个正则表达式:
(\d{1,20})
You may use a capturing group instead of the infinite-width positive lookbehind:您可以使用捕获组而不是无限宽度的正向后视:
(JPY;\s*\d{1,20})
And replace with $1.00
.并替换为
$1.00
。 See the regex demo .请参阅正则表达式演示。
Depending on the regex engine, you may remove the (...)
capturing parentheses, and use $0
or $&
instead of the $1
in the replacement pattern.根据正则表达式引擎,您可以删除
(...)
捕获括号,并在替换模式中使用$0
或$&
而不是$1
。
Also, if you need to match these values as whole words, enclose with word boundaries: \\b(JPY;\\s*\\d{1,20})\\b
.此外,如果您需要将这些值作为整个单词进行匹配,请用单词边界括起来:
\\b(JPY;\\s*\\d{1,20})\\b
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.