Regex defined for ADL Search does not work with v0.850

Bug #1414362 reported by LoRenZo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DC++
Fix Released
Undecided
Unassigned

Bug Description

The Regex definitions that I was using with 0.843 not seem to work with 0.850.
The System Log displays error messages such as the below:

Invalid regular expression: (?i)(?=.*?.flac.)

I believe this also forces the client to use extremely high memory allocation when opening very large file lists, which I have never experienced before.

Revision history for this message
poy (poy) wrote :

thanks for the example.

the regex implementation provider was changed between versions 0.843 and 0.850 from boost <http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/index.html> to libstdc++ <https://gcc.gnu.org/wiki/Regex>. hopefully tweaks can be found; otherwise we can always revert to the boost implementation.

2 sides to this topic:
- validity. the first step would be to make sure the example expression is actually valid (starting with a "?" sign seems strange to me); and if it is, why libstdc++ rejects it.
- performance.

Revision history for this message
LoRenZo (lorenzo-mailbox-deactivatedaccount) wrote :

Thank you for looking into it.

I am certainly not an expert, but when I was trying to find suggestions about how to implement a case insensitive search and using regex in general, this is the information that I managed to gather.

The fact that it was working for me under 0.843 makes me believe that I was using the proper syntax, too.
Needless to say, this is something for you to try with any strings for the different versions, and see the results that I was referring to.

Either way, as for me I would still prefer the old method even if there are other, valid syntaxes available.

Revision history for this message
cologic (cologic) wrote :

std::regex doesn't support the Perl mode modifiers such as (?i). It is, in fact, a valid RE.

http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html describes how the"Perl regular expression syntax is based on that used by the programming language Perl . Perl regular expressions are the default behavior in Boost.Regex". However, by contrast, http://www.cplusplus.com/reference/regex/regex_constants/#syntax_option_type lists only ECMAScript, basic, extended, awk, grep, and egrep-type REs, of which ECMAScript has been chosen as default.

http://www.regular-expressions.info/stdregex.html summarize the differences between these RE syntaxes; none of them, however, support the Perl-inspired case insensitivity mode modifiers such as LoRenZo uses. http://www.regular-expressions.info/javascript.html in particular notes that the syntax which std::regex implements by default, "JavaScript implements Perl-style regular expressions. However, it lacks quite a number of advanced features available in Perl and other modern regular expression flavors" such as "mode modifiers to set matching options within the regular expression".

It looks like if one wants to keep allowing (?i) and similar mode modifiers -- and convenient case insensitivity is pretty useful -- then reverting to boost::regex would make sense.

Revision history for this message
cologic (cologic) wrote :

An addendum: apparently at the end, "/i makes the regex match case insensitive" for ECMAScript regexes of the sort that std::regex supports.

LoRenZo: thus, does something like (?=.*?.flac.)/i or ?=.*?.flac./i or etc (if I'm getting it wrong) work in 0.850?

It still might make sense to revert to boost::regex for both compatibility and some of the other Perl-compatible regular expression features std::regex doesn't support, but case-insensitivity specifically is still achievable in a slightly different way.

Revision history for this message
poy (poy) wrote :

reverting back to boost regex; i am opening a new bug thread to look into doing this transition better in the future.

Changed in dcplusplus:
status: New → Fix Committed
Revision history for this message
poy (poy) wrote :

Fixed in DC++ 0.851.

Changed in dcplusplus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.