[Solved] Regular expression with specific characters in javascript [closed]

[ad_1]

Your requirements are perhaps not totally complete, but if I assume that you only want six digit characters at the end, something like the regex /H\d{3}-\d{4}-\d{6}/ would work. You can see it working here or in the snippet below:

const text="nonsense nonsense lorem ipsum H005-2007-652764 and then more nonsense";

const regex = /H\d{3}-\d{4}-\d{6}/;

console.log(text.match(regex));

[ad_2]

solved Regular expression with specific characters in javascript [closed]