I have a string (which is the value of href attribute) like this:
var url = '/myweb/search?s=islamic_sources&q=test';
It also sometimes looks like these:
url = '/myweb/search?q=test';
url = '/myweb/search?q=test&g=sth';
^[^?]+.*?&?q=([^$|&]+)
is what I've tried so far, and I need to match test
in those three lines. But sadly seems $
doesn't mean end of line in my pattern. How can I fix it?