Allow "any/or" and "all/and" searches to be combined

I originally made this to mimic Danbooru's behavior and, going by the "cheat sheet" which said "Or-searches do not work well with other tags", I made it so border matches either had to match all the tags provided or only one. This may or may not be how Danbooru behaves, but being limited to two tags doesn't allow me to test this. Whatever the case, I've now changed the script to allow "and" and "or" searches to be combined. In order to match, all tags not prefixed with a ~ have to be on the post and only one of the tags prefixed with a ~ has to be on the post.

Example: "long_hair ~blonde_hair ~red_hair" will match posts tagged with either blonde_hair or red_hair as long as they're also tagged with long_hair.

On another note, negative "or" search terms work, but their usefulness is probably limited.

Example: "~long_hair ~-short_hair" will match posts tagged with long_hair or not tagged with short_hair. The extra posts that get matched here are the ones not tagged with long_hair or short_hair aka the ones that are potentially long_hair and just missing the tag.