I'm currently working within an AngularJS directive and in the template I'm attempting to check if a an instance variable of the Controller is a certain type of string.
Specifically, this string can be anything at all so long as it has an 8-digit number in it.
Passing Examples: "gdbfgihfb 88827367 dfgfdg", "12345678", ".12345678"
The number has to be a solid string of 8 numbers with nothing in between.
I've tried this:
$ctrl.var == /[0-9]{8}/
But it doesn't work for some reason. How do I construct a regex in order to do this?
Thanks
/^[0-9]{8}$/./^\d{8}$/looks good too./.*\d{8}.*/