Say you have to parse strings to match something like this :
913|723
being xxx|yyy the coordinates.
How do I check with javascript and regex if the string matches the xxx|yyy (only numbers and the separator) ?
You can use regex pattern
^\d{3}\|\d{3}$
var pattern = '/^\d{3}\|\d{3}$/';
if (pattern.test(subject)) {
alert("matched");
}
You can online test here
"abc123|234def".