compile-time-regular-expressions icon indicating copy to clipboard operation
compile-time-regular-expressions copied to clipboard

incorrect match with repeated group

Open faceprint opened this issue 1 year ago • 3 comments
trafficstars

A regex with a repeated group and a lazy space character doesn't work like I expect. boost and the online regex demo tools behave as expected. Here's as simple an example as I could easily create:

regex: (([A-Z][a-z]+ *?){1,4}) g

The intent is to match 1 to 4 capitalized words in front of a word starting with g.

https://gcc.godbolt.org/z/v6KWrasYv

CTRE fails to match multiple capitalized words, and only matches the last one.

faceprint avatar Jan 08 '24 17:01 faceprint

Thanks, will look into it. It will take a while as I'm currently swamped.

hanickadot avatar Jan 08 '24 18:01 hanickadot