I'm not a 开发者_JS百科JS guru, but could someone help me find the invalid quantifier error in the following snippet?
THANKS IN ADVANCE! -mprototype
function $_GET(q,s) {
        s = s ? s : window.location.search;
        var re = new RegExp( '&' + q + '(?:=([^&]*))?(?=&|$)' , 'i' );
        return (s=s.replace(/^?/,'&').match(re)) ? (typeof s[1] == 'undefined' ? '' : decodeURIComponent(s[1])) : undefined;
    } 
? has a special meaning in Regular Expressions, specifically it makes the preceding item optional. If you are trying to find the question mark character itself you need to escape it with a backslash.
function $_GET(q,s) {
        s = s ? s : window.location.search;
        var re = new RegExp( '&' + q + '(?:=([^&]*))?(?=&|$)' , 'i' );
        return (s=s.replace(/^\?/,'&').match(re)) ? (typeof s[1] == 'undefined' ? '' : decodeURIComponent(s[1])) : undefined;
    } 
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论