Thank you very much for you answer. It works but there is a problem: I would to successfully match the string if '#foo' is not there (0 or 1 occurences)
| [reply] |
It already does do that.
Specifically, it always matches, setting $1 to foo if #\w+ is found at the start of the string, and setting $1 to undef otherwise.
| [reply] [d/l] [select] |
That said, I believe it has other problems.
It doesn't set $1 to foo when matching against bli #foo bla.
It doesn't set $1 to the empty string when matching against bli bla. However, it does set it to undef, which might be close enough.
| [reply] [d/l] [select] |