As part of some lemmatization rules, I'm trying to form a regular expression that will match strings ending in 'ses', 'zes', 'xes', 'ches' or 'shes' and I'm having difficulty getting the letter groupings correct. I thought the following would work...
re.fullmatch(r'.*[szx(ch)(sh)]es\b', infl)
but I see that this will match 'ces' or 'hes word endings where I only want it to match 'ches' word endings (same for the (sh) grouping). I must be misunderstanding how to 'or' together groups correctly. Whenever I put a bracket around a set of groups I match all letters inside, not just the letter combos.
How can I reform the fullmatch
expression to work correctly? I must be misunderstanding how combining groupings work so a short explanation of that, in this context, would also be helpful.
BTW... I only need a true/false return. I'm not interested in the returned values.
Some matching examples are: dismisses, waltzes, indexes, detaches, distinguishes.