[SERVER-26541] Stop linking boost::regex Created: 09/Oct/16  Updated: 06/Dec/17  Resolved: 15/Jun/17

Status: Closed
Project: Core Server
Component/s: Portability
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Improvement Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Tyler Kaye
Resolution: Done Votes: 0
Labels: neweng, platforms-interns-2017
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-06-19
Participants:

 Description   

We now have regex support via std::regex. We should use that instead. The only current user of boost::regex is mongo::MongoURI, which could be easily switched over.



 Comments   
Comment by Githook User [ 15/Jun/17 ]

Author:

{u'username': u'tkaye407', u'name': u'Tyler Kaye', u'email': u'tkaye@princeton.edu'}

Message: SERVER-26541 Remove dependence on boost::regex() by replacing all of its instances with std::regex()
Branch: master
https://github.com/mongodb/mongo/commit/cde889643b317ee0e8cb4fa72a4dbc162c75bb1c

Comment by Tyler Kaye [ 14/Jun/17 ]

After some research, I think that we may be able to simply substitute the word 'std' for 'boost' and it works because the standard library is interfacing the boost library and the function calls are all the same. I understand that std::regexp is defined with ECMAScript as opposed to PCRE, but according to the table in (https://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines#Language_features) as long as we don't use recursion or look ahead (which we don't) then they have the same functionality and I have not found anything in the syntax specifications that would suggest they are not compatible. Thus, I made the changes in both array_filter.cpp and mongo_uri.cpp and then ran their corresponding test files and they worked perfectly.

Comment by Andrew Morrow (Inactive) [ 13/Jun/17 ]

Please note that in the above (closed) code review, it was pointed out that we were using boost::regex in PCRE mode. However, std::regex, with which we wanted to replace it, does not support PCRE. Since that review, another instance of boost::regex usage has been added, so that problem now exists in side update/array_filter.cpp.

When fixing this ticket, either:

  • Those usages of boost::regex should be replaced with direct usage of libpcre (which we have vendored). This would have the advantage that we could presumably use the regex unchanged.
  • Those usages of boost::regex should be replaced with std::regex, using a different regex form. The regex strings will need to be translated to the new domain.
Generated at Thu Feb 08 04:12:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.