[英]Convert MS Word Wildcards search patterns to Regex?
I am trying to convert a MS Word search wildcard pattern to regular expression (which can be used at http://regexr.com ), since Word stated my pattern is too complex for it to handle. 我正在尝试将MS Word搜索通配符模式转换为正则表达式(可在http://regexr.com上使用),因为Word表示我的模式太复杂而无法处理。
My search wildcard is look like this: 我的搜索通配符如下所示:
A[!A]{1,}A[!A]{1,}A[!A]{1,}A[!A]{1,}A[!A]{1,}A[!A]{1,}A[!A]{1,}
Which will match those string patterns in MS Word: 它将与MS Word中的那些字符串模式匹配:
A [a string which does not contain character "A"] A [a string which does not contain character "A"] A [...]
But I cannot find any possible solution to convert it into regular expression which I could use on that website. 但是我找不到任何可能的解决方案将其转换为我可以在该网站上使用的正则表达式。
I already researched in several topics about some kinds of converting (negative lookahead/lookbehind), but it seems that it would not match my problem. 我已经研究了一些有关某种转换的主题(负向超前/向后看),但似乎与我的问题不符。
I am very appreciated if you guys can share some idea! 如果您能分享一些想法,我将不胜感激! Thanks!
谢谢!
You can replace !
您可以更换
!
by ^
and optionnaly {1,}
by +
. 通过
^
和optionnaly {1,}
通过+
。
A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+
See this nice regexp cheat sheet for more details. 有关更多详细信息,请参见此漂亮的regexp备忘单 。
I finally found out that the answer is A[^A]+A
for every A [a string which does not contain character "A"] A
我终于发现答案是每个
A [a string which does not contain character "A"] A
A[^A]+A
A [a string which does not contain character "A"] A
Thank you guys! 感谢大伙们! :D
:d
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.