I have an String Like that:
String word ="[word";
I want to search this string as a substring to find Strings that contains these string. I have a query like that :
String Quert ="PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
+ " SELECT ?class WHERE { ?class rdfs:label ?v ." +
"FILTER regex(?v, \"" + word +"\", \"i\")}" ;
and when I run the program an error occur.
Regex: Pattern exception: java.util.regex.PatternSyntaxException: Unclosed character class near index 6
So, how can I search this substring without producing this error?
edit: I use
Pattern.quote(word)
but I is producing another error:
Lexical error at line 1, column 118. Encountered: "Q" (81), after : "\"\\"