[wxRegEx] with (wxRE_ADVANCED) [need help]

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
tomay3000
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Mon Apr 24, 2017 4:23 am

[wxRegEx] with (wxRE_ADVANCED) [need help]

Post by tomay3000 »

Hello,
1st - what does (built-in regex only) means in wxRE_ADVANCED definition ?
2nd - This regex expression assertion is never matching!!

Code: Select all

wxRegEx reCIMI("\r\n(\d{15})\r\n\r\nOK\r\n", wxRE_ADVANCED | wxRE_ICASE);
wxASSERT(reCIMI.Matches("\r\n603032919337089\r\n\r\nOK\r\n"))
What could be the problem ? [-o<

Thank you for your understanding.
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: [wxRegEx] with (wxRE_ADVANCED) [need help]

Post by coderrc »

wxRegex is built on top of either the system library (if it has support for POSIX regular expressions - which is the case of the most modern Unices) or uses the built in Henry Spencer's library. Henry Spencer would appreciate being given credit in the documentation of software which uses his library, but that is not a requirement.
tomay3000 wrote: 2nd - This regex expression assertion is never matching!!

Code: Select all

wxRegEx reCIMI("\r\n(\d{15})\r\n\r\nOK\r\n", wxRE_ADVANCED | wxRE_ICASE);
wxASSERT(reCIMI.Matches("\r\n603032919337089\r\n\r\nOK\r\n"))
What could be the problem ?
It could be that
When using the system library in Unicode mode, the expressions and data are translated to the default 8-bit encoding before being passed to the library.
and somehow as part of this conversion the carriage return and newline escapes are being converted from escape sequences to string literals "\r\n" instead of "\x0d\x0a"

It could be that you need to OR in wxRE_NEWLINE to your regex flags

it probably isnt, but the possibility exists that you need to include those stupid %$@%ing slashes like you do in javascript and such
Post Reply