简体   繁体   中英

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.

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:

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

A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+A[^A]+

See this nice regexp cheat sheet for more details.

I finally found out that the answer is A[^A]+A for every A [a string which does not contain character "A"] A

Thank you guys! :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM