Hope you are fine.
I am not able to resolve my issue alone with a regex (in javascript).
I have the following strings :
ex 1:
error Lorem Ipsum warning dummy text info one more example for test error Another issue
ex 2:
error Lorem1 Ipsum1 error Lorem2 Ipsum2
For the two cases, I would like to split the text into 4 or 2 groups :
ex 1:
error Lorem Ipsum
warning dummy text
info one more example for test
error Another issue
ex 2:
error Lorem1 Ipsum1
error Lorem2 Ipsum2
I pretty sure that the solution is not really complicated.
Currently I am able to capture the keyword and the first characters but not all the characters (quantity of characters is not defined).
/((warning|error|info)(?:(^warning|error|info)*...))/gisu
And result is :
error Lo
warning th
info Lo
error An
Regex101 page : https://regex101.com/r/O9Jz5B/1
Thanks for your help.
\b(?:warning|error|info)\b.*?(?=\s*(?:warning|error|info|$))regex101.com/r/WxCgZp/1