String text = "[! hello ¡world ¡] otra cosa ¡]";
String pt = "\\[!(.*)¡\\]";
Matcher mc = Pattern.compile(pt).matcher(text);
while( mc.find() ){
System.out.println(mc.group(1));
}
This code prints hello ¡world ¡] otra cosa
.
What would be a pattern that matches only hello ¡world
?
What I don't find is a way to negate a literal string instead of just a char. Something like: ([^(¡\])]*)
The question is:
How to match everything that is NOT a literal string?