There is a string like “mid = 61266817536127044185 & srcid = 3002299072”
How to write a regular expression if you want to match the first number after mid =? I used this new regexp (/ mid = ([0-9] +) / g); I found “mid = 6126681753”, but I didn’t want “mid =”.
Another method is PCRE’s look ahead. If you are interested, you can learn about it.For an example, see the comments in this response.
var matches = new RegExp(/(?!mid=)[0-9]+/g).exec(“?mid=6126681753,6127044185&srcid=3002299072”); console.log(matches)
Now that you’ve specified a subpattern, that’s fine.
var matches = new RegExp(/mid=([0-9]+)/g).exec("?mid=6126681753,6127044185&srcid=3002299072"); console.log(matches);