Extract Substrings using regex Java -


i have string has several np( ), in between "np(' , ')' data want. want np data inside not first np outside

how can write regex extract "(dt a) (nn sign)" , "(dt the) (nn facade)" following text? wnt each text contain np extract inside np data..i hope explained problem

    (root (np (np (dt a) (nn sign)) (pp (in on) (np (np (dt the) (nn facade)) (pp (in of) (np (dt the) (nn building))))))) 

this regex match data asking:

\(dt\s\w+.{3}nn\s\w+\) 

where \(dt\s\w+ match determiner, thr white space , string, .{3} match ) ( , nn\s\w+\) match noun, singular or mass.
using regexpal match data if want use in java code need escape charactes this:

pattern p = pattern.compile("\\(dt\\s\\w+.{3}nn\\s\\w+\\)"); 

Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -