Monday, 9 January 2017

Does Emacs regex support possessive quantifiers?



Referring to this question, which I found quite interesting. Can't test right now if Emacs supports possessive quantifiers. The manual says that lazy quantifiers are supported:




?, +?, ?? are non-greedy variants of the operators above. The normal operators ‘’, ‘+’, ‘?’ match as much as they can, as long as the overall regexp can still match. With a following ‘?’, they will match as little as possible...




But could not find anything about possessive quantifiers like ?+, *+, ++




For example on string ab
.*+a|b would match b but .*a|b would match a.



Are possessive quantifiers supported in Emacs regex flavor?


Answer



No, Emacs does not support *+ etc. See the Elisp manual, node Regexp Special.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...