Java regex matcher always returns false

I have a string expression from which I need to get some values. The string is as follows

#min({(((fields['example6'].value + fields['example5'].value) * ((fields['example1'].value*5)+fields['example2'].value+fields['example3'].value-fields['example4'].value)) * 0.15),15,9.087})

From this I need a string array list which contains the values such as “example1”, “example2” and so on.

I have a Java method which looks like this

String regex = "/fields[['"]([ws]+)['"]]/g";
ArrayList<String> arL = new ArrayList<String>();
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(expression);


But m.find() always returns false. Is there anything I’m missing?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.