✅ – dmikester1 – 15-27 Mar 21

Is this a good room to ask a regex(in Javascript) question?
D
dmikester1393d ago
OK, so all I'm trying to figure out is how to match a single colon [:] or a space followed by a hyphen [ -] ? If it was just a colon or hyphen, i know I could do [:-].
UU
Unknown User393d ago
D
dmikester1393d ago
sorry I mean a (colon) or (a space followed by a hyphen) does that make sense?
D
dmikester1393d ago
regex101
regex101: build, test, and debug regex
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
D
dmikester1393d ago
I am close there I don't want the last part in a seperate group i want it part of the match
S
ScriptyChris392d ago
Like this?
^[\s]?slide [\d]{1,2}(?:\:|\s-)
^[\s]?slide [\d]{1,2}(?:\:|\s-)
D
dmikester1392d ago
Yes, that works perfect! Thank you!
UU
Unknown User392d ago