SCI_REPLACEINTARGETRE does not respect SCFIND_CXX11REGEX

16 views
Skip to first unread message

Stefan Küng

unread,
Oct 22, 2021, 3:57:53 AM10/22/21
to scintilla-interest
When replacing text with SCI_REPLACEINTARGETRE the format specifiers of the replace text are not fully respected according to the c++11 regex specs.
From what I found is that the replacement is done with a custom function instead of using the proper std::regex_replace() function.
For example, for c++ regex the group replacements are $0..$99 and not \0..\9, also $&, $` and $´ are also valid formatting sequences. See:

maybe Scintilla could use the format function instead of its custom one?

Stefan

Neil Hodgson

unread,
Oct 22, 2021, 6:45:40 PM10/22/21
to Scintilla mailing list
Stefan Küng:

> maybe Scintilla could use the format function instead of its custom one?
> https://www.cplusplus.com/reference/regex/match_results/format/

That would be an incompatible change so an implementation should retain compatibility with current client code and use another flag (probably in SCFIND_*) to enable the change.

Neil

Stefan Küng

unread,
Oct 23, 2021, 7:59:49 AM10/23/21
to scintilla-interest
On Saturday, October 23, 2021 at 12:45:40 AM UTC+2 Neil Hodgson wrote:

That would be an incompatible change so an implementation should retain compatibility with current client code and use another flag (probably in SCFIND_*) to enable the change.


or maybe a compiler directive (#ifdef) would suffice here. I don't think that apps would switch between the two implementations at runtime.

Stefan

Reply all
Reply to author
Forward
0 new messages