replace - How to insert text before the first line if a certain word exists in the whole text with regex? -


i'd regex.

example:

convert this(where bla can text):

bla bla blaba bla bla blablbalba bala bla cocoa bla bla bla bla bla bla bla bla bla bla 

to this:

chocolate unhealty! bla bla blaba bla bla blablbalba bala bla cocoa bla bla bla bla bla bla bla bla bla bla 

search

(.*\n.*cocoa.*\n.*) 

and replace by

chocolate unhealty!$1 

() stores result can access later $1. .* matches char 0 unlimited times. \n matches newline.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -