Skip to content

Add regular expression operator

Current situation

In expressions, strings can be compared for equality (or difference), but there is no way to refine those comparisons.

Desired outcome

A more generic way to test strings. Regular expressions would be nice

Analysis

Adding a ~= infix comparison operator (left hand side is a string, right hand side is a string interpreted as a regular expression) would provide the desired outcome.

  • still comparing things in a case-insensitive way
  • allows for partial match

Examples

'foo' ~= '^foo$'    # strict equality
'foo' ~= '^fo'      # starts with 'fo'
'foo' ~= 'o'        # contains at least one 'o'