Skip to content

how to implement the 'like' bool expression using expr #673

Description

@cocktail828

hello maintainers. I am trying to parse bool expression like this using expr a>10 && b like '%abc' && c not in ['a', 'b'].
But expr does not support like natively. So is there any ways to make expr support 'like' bool expression.
Thanks, in advance!

Activity

  1. nikolaymatrosov commented on Jul 1, 2024

    @nikolaymatrosov
    Contributor

    The matches operator is likely to meet your requirements. It verifies whether the left-hand operand conforms to the regular expression specified by the right-hand operand. For instance:

    "aaa" matches "^a+$" == true
    "abc" matches "^a+$" == false
    

    https://expr-lang.org/docs/language-definition#operators

  2. locked and limited conversation to collaborators on Jul 1, 2024
  3. converted this issue into a discussion #681 on Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions