Hi I need a Regex that can actually get any letter that is inserted after "-" dash e.g i have a string that says
"UpTown-R" , "Category-C"
What I get in return is "R" , "C".
If is always the last part of the string, you can do this
/[^-]+$/
see it here on Regexr
[^-] is a character class that matches everything that is not a dash
[^-]
+ quantifier means one or more of the preceding element
+
$ anchor for the end of the string
$
2.1m questions
2.1m answers
60 comments
57.0k users