Issue 1852 - Using wildcards in field searches is not working properly

Corrected the code that is in charge of matching regular expressions of fields. The problem was that we needed to use different syntax for SQL Lite and the Java Pattern class, when matching the expressions.

Also, removed the line:
```
String regex = Pattern.quote(val).replace("\\Q_\\E", ".").replace("\\Q%\\E", ".*");
```
Because the regex matching already makes sure that the string matches exactly.

Also, created the pattern outside of the loop, to make sure only one is created:
```
Pattern thePattern = Pattern.compile(val, Pattern.CASE_INSENSITIVE);
while(...
```
Also made sure to test several cases of field search. Any comments are welcome!