且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

正则表达式匹配并替换单词中的前缀和后缀

更新时间:2023-02-26 10:07:19

\ban(?=d\b)

将匹配和中的an,但不是an,hand等。

will match "an" in "and", but not in "an", "hand", etc.

(?<=\bsimp)lg\b

将匹配simplg中的lg,但不会匹配lg,bulge等等。



正则表达式语言 - 快速参考 [ ^ ]

Expresso正则表达式工具 [ ^ ]

will match "lg" in "simplg", but not in "lg", "bulge", etc.

Regular Expression Language - Quick Reference[^]
Expresso Regular Expression Tool[^]


不是解决方案,但链接可能有用。

以下是RegEx文档的链接:

perlre - perldoc.perl.org [ ^ ]

以下是工具的链接帮助构建RegEx并调试它们:

.NET正则表达式测试程序 - 正则表达式风暴 [ ^ ]

快速正则表达式工具 [ ^ ]

这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:

Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]
Not a solution, but links may be useful.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]