I am trying to create a Regex to match patterns existing in multiple lines. The code is as follows:
(.*Action name.*\n.*Action status.*)[\n+]*(good)
The text string is as follows:
Workflow name:icl_prd_db_logs
Action name:backup
Action status:failed
hi
how r u
good
perfect
Code successfully completed
Another code failed
Now I can use one \n if I want to match Action name and Action status because those are sequential lines. But, if I want to match a line which exists after several lines then a single \n will not work. In other words, how can I use \n multiple times something like [\n]+ or [\n]*+ or [\n+](.*).
I don't want to use any arrays just I need a single line code which can map all the existing pattern matches. Does anyone know how to do that?
In the above-mentioned code, I am trying to search good pattern which is two lines away from the Action status line so I have tried to use [\n+]* but it doesn't work at all. Can anyone help me to sort out this code?