I want to write a regex expression that will match the following text:
200502-title-of-something
I would like the expression to match any occurrence of a six digit date followed by a string of text separated by dashes.
I am using this for custom syntax highlighting in a sublime-syntax file (YAML 1.2).
I would like the expression to match any occurrence of a six digit date \d{6}
followed by a string of text [a-zA-Z]+
separated by dashes-
.
To summarize:
\b\d{6}(?:-[a-zA-Z]+)+\b
where:
\b
is a word boundary-
a hyphen[a-zA-Z]+
a character class that matches 1 or more letters(?:...)+
a non capture group, that may appear 1 or more times