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

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

python - Pygame screen.blit not working -

c# - Web API response xml language -