I have a string like:
some text here 'quoted text here' some more text
I'd like to get the 'quoted text here' without the quotes. Besides using indexOf(') and then substring, how can I look this up using a regular expression in Java?
I have a string like:
some text here 'quoted text here' some more text
I'd like to get the 'quoted text here' without the quotes. Besides using indexOf(') and then substring, how can I look this up using a regular expression in Java?
String text = "some text here 'quoted text here' some more text";
String regex = "'(.*?)'";
Pattern pattern = Pattern.compile(regex);
Matcher m = pattern.matcher(text);
if (m.find()){
String s = m.group(1);
System.out.println(s);
}