Answer the question
In order to leave comments, you need to log in
How to use a regular expression to find certain words in the text after a certain word?
"{\"to_email\":\\"task_id\":\"39a84a7b-b937-4901-90a5-eb19a9411e7e\",\"cc\":[],\"bcc\":[],\"to \":{\"loaded_data\":null,\"generators\":[],\"account_name\":\"taxi\"},\"external_contract_id\":\"2291177/21\",\" reason\":\"notify\"}}"
Text without spaces is given. How to use a regular expression to find certain words (debt, notify, another) if they come after the word reason? That is, if these words come before the word reason - they should not be, if they are after - they should.
Answer the question
In order to leave comments, you need to log in
The correct answer is to use the built-in json parser of the language you are working with and not engage in perversions.
Shitty answer: or depending on how crooked your line is. It will fail without options if there are quotation marks in the searched word. /(?<="reason":")([^"]+)/
/(?<=\\"reason\\":\\")(.+?)(?=\\")/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question