How do I make regex to ignore whitespace within google searches? #442
-
This tapatalk post provides a regex expression, ^https?:/+((www.)?google.com)/search(.)q=(\w+++)(blue|green|red), that allows leechblock to block certain google searches. But it does not handle spaces inside of terms, which show up as a '+' in the url (e.g. blue or blue+red will match but not b+lue, bl+ue, blu+e). So I can pretty easily invalidate this regex. How do I get it to ignore spaces in a google search query? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I'm curious. Why would you need to match spaces within search terms? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the explanation. I understand now. I didn't know Google did that. The solution is messy, but it would look like this:
In sum, put |
Beta Was this translation helpful? Give feedback.
Thanks for the explanation. I understand now. I didn't know Google did that.
The solution is messy, but it would look like this:
^https?:\/+((www\.)?google\.com)\/search(.*)q=(\w+\++)*(b\+*l\+*u\+*e|g\+*r\+*e\+*e\+*n|r\+*e\+*d)
In sum, put
\+*
where any space might be between letters.