ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
338 stars 37 forks source link

what is the regex syntax to turn all of {searchTerm} to lower-case? #579

Closed 11100010 closed 2 years ago

11100010 commented 2 years ago

I've tried some syntax from google search, then only received "invalid regex" response. Please help me figure it out, thank you so much.

ssborbis commented 2 years ago

Javascript regex doesn't have a direct way to convert to lowercase like some other interpreters do. The simplest solution is probably to change your engine from a GET/POST style to a javascript-style. Got a link to the website you're trying to get working?

ssborbis commented 2 years ago

I think I'll add %su and %sl as variables in templates

11100010 commented 2 years ago

here you go https://www.cia.gov/the-world-factbook/countries/{searchTerms}

11100010 commented 2 years ago

i'v just solved it, not a smart way, but it works :D "A","a" "B","b" "C","c" "D","d" "E","e" "F","f" "G","g" "H","h" "I","i" "J","j" "K","k" "L","l" "M","m" "N","n" "O","o" "P","p" "Q","q" "R","r" "S","s" "T","t" "U","u" "V","v" "W","w" "X","x" "Y","y" "Z","z"

ssborbis commented 2 years ago

That also works. I was reluctant to post it as a solution, since it's a bit of a mess. My latest code accepts the variables I mentioned, so future versions won't need this workaround.