Regex to match multiple integer words

How to write a regex that works in wxRegEx to match this pseudo pseudo mode*good|better|best* :?

I know about regex matching at the character level, i.e. *.[ch]ppbut how does he advance to whole words?

Thank.

+3
source share
2 answers

This question is a good example of why you should always indicate the flavor of the regular expression that you use. Most regular expression flavors provide a way to match word boundaries, and most of them are used \bfor this. According to this page , wxRegEx allows you to choose one of three options: BRE, ERE or ARE. Of these, only ARE supports word boundaries and uses \y, rather than \b. Assuming you specify wxRE_ADVANCEDwhen compiling, this regular expression will match any string containing one of the words good, betteror best:

\y(good|better|best)\y

, , , . , *.[ch] - , , .c .h; \.[ch]$. , , , , , , glob. .*, $ , foo.cs bar.html.

+2

good|better|best

, "". , .

+1

Source: https://habr.com/ru/post/1785549/


All Articles