I understand how to retrieve digits from a string after reading Regex using javascript to return just numbers
I am wondering if I can validate my input at the same time. While implementing an LMS, I am looking for input strings matching "com.interactions.*n*.objectives.*m*.id
", where n & m are integers.
In one regex function, can I retrieve the digits n & m ONLY IF my input string matches the pattern above? Or do I need to first validate the input string, and then pull the digits out afterwards?