php - regular expression to match querysting includes array -


preg_match(#(?:([a-za-z-]+):)?(?://(?:([a-za-z0-9_!$&\'()*+,;=._~%-]+)(?::([a-za-z0-9_!$&\'()*+,;=._~%-]*))?@)?([a-za-z0-9-._]+)(?::([0-9]*))?)?([a-za-z0-9_!$&\'()*@+,:;=._~/%-]*)(?:\\?([0-9a-za-z!$&\'()*@+,:;=._~%-]*))?(?:\\#(.*))?#, $uri, $m)); 

the regex above used match urls , result supposed m[1] = scheme m[2] = user m[3] = pass m[4] = host m[5] = port m[6] = path m[7] = querystring m[8] = fragment

it works except when querystring includes array, example: ?ar[k1]=v1&ar[k2]=v2

my questions are: 1.what meaning of sharp # in regex 2.how can modify regex make matches querystring include array

1.the sharp (# 2nd) in regex meaning part of url

scheme://username:password@domain:port/path?query_string#fragment_id

2.parse url , return components


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -