... and then simply leave off the closing anchor and it won't matter what, if anything, comes afterward. If your plugin doesn't do anchors-- meaning that it doesn't recognize the lack of an anchor-- add
at the end.
A literal space in the query should always turn into a + sign before it goes anywhere. But it it doesn't and you need to allow for all possibilities, replace \+ with
How could you write this in htaccess
Meaningless question, unfortunately. The rule has to be written for some specific module. If it were really htaccess, meaning apache, you'd be looking at mod_rewrite. But surely you're in IIS?