Skip to content

How to get Regex match value(s)? #113

@jheliker

Description

@jheliker

Hello -

First off, thanks so much for the great library!

I'm trying to test the Regex function, and I have the following regular expression: (\d+)(?!.*\d)") which matches the last number of the input. I see Expressive is correctly accepting my regex by doing the following:

Regex("Test", "(\d+)(?!.*\d)")
Which returns False (there are no numbers in "Test")

and

Regex("Test123", "(\d+)(?!.*\d)")
Which returns True

What I really need, however, is to get the first match returned back.

So, in the first example above, I'd have an empty string returned instead of False, and in the second example above, I'd have "123" returned instead of True. Is this possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions