Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 415
    • Issues 415
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #739
Closed
Open
Issue created Feb 22, 2018 by Mark OLESEN@markMaintainer

avoid implicit conversion of string to regExp in string-list matching

Currently have this type of code:

labelList findStrings(const std::string& re, const UList<StringType>& lst, const bool invert=false)
{
    const regExp matcher(re);
    return findMatchingStrings(matcher, lst, invert);
}

This means that the seeming innocuous call

findStrings(someWord, listOfString);

actually incurs an additional regExp allocation and then uses this for performing the match. If the word contains a '.' meta-character, this could well lead to false positives. In either case, we would be using the regex matcher when a simple string compare would also work.

Assignee
Assign to
Time tracking