Groups, captures and backreferences
·hard
The optional half
Match a username, optionally followed by an @ and a host. Capture the username as group one and the host as group two. When there is no host, group two must take no part at all — not match an empty string.
//
Corpus
Steps0/ 603 · par 201| Input | Match | Steps |
|---|---|---|
| (empty) | 3 | |
| (empty) | 3 | |
| (empty) | 3 | |
| (empty) | 3 | |
| (empty) | 3 | |
| (empty) | 3 |
Trace
Select an input to step through what your pattern did to it.
Cmd-Enter submits too.