I need to capture a number passed as appended integers to a CSS class. My regex is pretty weak, what I’m looking to do is pretty simple. I thought that “negative word boundary” \B was the flag I wanted but I guess I was wrong
string = "foo bar-15";
var theInteger = string.replace('/bar\-\B', ''); // expected result = 15
Use a capture group as outlined here:
Then you can just do an
if (theInteger)wherever you need to use it