The problem of regular expressions matching url

the following regular expression can successfully configure key, (^ |) in url. Doesn"t it mean start or empty? how can it match & what"s wrong with it?
regular

?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=baidu&wd=%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F&rsv_pq=eeeb21a20001f388&rsv_t=4ba6XCweLIFwqACbIt7eT8yuqYQfNU7ZJNTlLenvEtVVFm4jVEnL5O48Ze0&rqlang=cn&rsv_enter=1&rsv_sug3=6&rsv_sug1=6&rsv_sug7=100

regular matches to rsv_bp=0


here is (^ |) . It may look a little weird. If I write it in another way, maybe you will understand:


(^|)

/(^|)aaa/.test('sfdsfaaa')
true
/(^|||||)aaa/.test('sfdsfaaa')
true

this means that the beginning or nothing matches | it has the same meaning as this.
if you want to match spaces, it's like this.

/^|\s/
Menu