javascript - Regex - I want my string to end with 2 special character -


i've been trying make regex ends 2 special characters, couldnt find solution. here tried, seems not working.

/.[!@#$%^&*]{2}+$/; 

thanks in advance.

try regex:

^.*[!@#$%^&*]{2}$ 

demo

const regex = /^.*[!@#$%^&*]{2}$/;  const str = `abc@#\$`;  let m;    if(str.match(regex)) {  console.log("matched");  }  else    console.log("not matched");


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -