JS regular matching

var a = "ww.abc.com/?page=11"
how do I regularly match all the characters before the 11 digits? And give it a new variable!

May.22,2021

'ww.abc.com/?page=11'.replace (/. * (? = 11) /,' ddd')


a.replace (/ (. +?) dhammer,'$1')


  1. if you are not familiar with your own rules, then I advise you not to use them, or you will have to ask again in case something goes wrong
  2. if the string is very stable, go straight to split ('?') , and then split ('=') to find
  3. .
  4. if the string is not very stable, I guess you probably can't write regular rules well. If you don't require compatibility with IE, you can use URL .
  5. it is recommended to learn the rules rather than go to the forum and ask
Menu