nom parsers similar to regex expression “( … )?”
In regex there exists the ?
-operator that can be put behind expressions to indicate that they can be there or not. They are essentially the same as “this pattern repeats 0 or 1 times”. I want to do this in nom.
Technically I have a solution for this problem, but it feels like a workaround:
If I want to have a parser that
a) returns the parsed string if successful, or
b) returns an empty string if not successful
my go-to method now is to do this: