java - Regex positive look behind for regex reverse matching? -
how can match string literal reverse direction match string literal above it?
basically match "match" behind , match "here:" match "here:" end of string (to delete)
-- input --
keep  here: match test test  should deleted -- expected output (after match , delete) --
   keep 
you don't need make movement, need find "here:" , ensure string contains "match" after (if not case, pattern fail):
(?s)here:.*?match.* (?s) dot can match newlines
however, if possible, obtain better performances using indexof method "match" , "here:", comparing result , cuting string @ index of "here:"
Comments
Post a Comment