regex - Regular expression to fetch lines evaluating only one part of a string, java -


i'm trying find regular expression match part of pattern

for example text :

goodclass.nicemethod badclass.nicemethod badclass2.nicemethod verybadclass.nicemethod goodclass.nicemethod badclass.nicemethod badclass2.nicemethod goodclass.nicemethod 

how can lines 'nicemethod' not follow 'goodclass'

you can use negative lookbehind:

string regex = "(?<!goodclass\\.)\\bnicemethod\\b"; 

Comments

Popular posts from this blog

java - Checkbox item adds to spinner -

php - mySQL problems with this code? -

C# MVC AngularJS -