[Solved] Extract Substrings using regex Java [closed]


This regex will match all the data that are you asking:

\(DT\s\w+.{3}NN\s\w+\)

Where \(DT\s\w+ match the Determiner, thr white space and the string, .{3} match ) ( and NN\s\w+\) match the Noun, singular or mass.
Using regexpal match the data but if you want use it in Java code you need to escape the charactes so it will look like this:

Pattern p = Pattern.compile("\\(DT\\s\\w+.{3}NN\\s\\w+\\)");

3

solved Extract Substrings using regex Java [closed]