Skip to content

Evaluate and clean up regex accessing #368

@tamacodechi

Description

@tamacodechi

Some of our detectors have adopted a strange way of dealing with regexes ie.
/#{ALL_SYMBOLS.map { |s| Regexp.quote(s) }.join('|')}/

This was the case in the relative date detector because in the calculation we do a check if any terms .include? but we can remove this and replace it with =~ which instantly removes 3 lines of code and lots of complication (tested and proven to work!)

The detectors that use this style of filtering are:

  • currency detector
  • invoice number label detector
  • relative date detector

I've tested removing it from the relative date detector and it works. The due date label detector contains the same logic but also works without it. Please investigate and save our detectors from unnecessary code! 👏

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions