Apache OpenOffice (AOO) Bugzilla – Issue 112046
Regular expression with braces [:alpha:]{2}+ doesn't work properly
Last modified: 2017-05-20 10:12:47 UTC
Regular expression with braces [:alpha:]{2}+ doesn't work properly. This expression should work the same way as [:alpha:][:alpha:]+ (right?). But it doesn't. Often [:alpha:]{2}+ gives a word without the last symbol, [:alpha:]{3}+ gives a word without the 2 last symbols and so on. Tested with Ubuntu 10.04 + OOO320m12, OOO320m18, DEV300m80.
Reassigned to SBA
Nested quantifiers are something of a gray area in regular expressions. I'm not sure there is any clear "right" or "wrong" in this case. If you were trying to match "two or more alpha's", then you would normally use something like your alternative pattern: [:alpha:][:alpha:]+ Or the equivalent: [:alpha:]{2,} (Note the added comma). When the {min,max} quantifier has no comma and no 'max' ("{2}"), it means exactly "min" repetitions. When there is a "min" with a comma but no "max" ("{2,}"), it means "min or more" repetitions. A search in Writer for "[:alpha:]{2,}" finds any span of two or more alpha characters, as expected.
May I disagree ? [:alpha:]{2}+ does exactly what it is meant to : one or more groups of two letters, i.e. 2, 4, 6... letters. If a word contains an odd number of letters, last one will not be selected.
Please attach example.
No info from author.