I'm not that savvy in regex, so I'm not sure how to achieve the following thing:
I'd like to capture any arbitary string from an input that may or may not be surrounded by the '$' character. If a '$' character is present at the beginning of the string, the '$' character at the end must be present.
Currently I have
^\w+([_.-]\w+)*$
which roughly translates to:
- Arbitary word characters
- Beginning of capture group
- any character of '_', '.', '-'
- Before an optional \n
So valid matches would be:
test
test-5
test.1.3
test-alpha.2
Now I'd like to make this possible
$test$
But not...
$test (or test$)
Aucun commentaire:
Enregistrer un commentaire