javascript - Write a regexp parsing URL -
i trying write regex following
if have url
example.com?mask=33&filter=23423&mode=12
it match substring filter=23423
i need consider url can be
example.com?filter=23423
thanks in advance.
you may not consider [\?&] in regexp , put /filter=[0-9]*/ if sure there not params other_filter=987 in url. if may have such use substr on resulted regexp
url.match(/[\?&]filter=[0-9]*/)[0].substr(1)
Comments
Post a Comment