Sunday, November 6, 2022

[FIXED] How do I group every each 'HELLO THERE WORLD' lines?

Issue

enter image description here

I want to capture the 'HELLO THERE WORLD' lines, but use the start and the end lines. However, it's just taking the last line.

regex: start\n(((\w+) (.+) (.+))\n)+end

examples:

abcd 123 123
start
abcd 123 123
abcd 123 123
abcd 123 123
end
abcd 123 123

In the examples I want all the text between the start and the end to be In 3 groups for each line(group1=abcd,group2=123,group3=123) like that:

enter image description here


Solution

(?s)(?!.*?start)^(\w+)\s(\w+)\s(\w+)(?=.*?end)

enter image description here

https://regex101.com/r/fDcMJd/1



Answered By - ZygD
Answer Checked By - Marie Seifert (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.