PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 6, 2022

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

 November 06, 2022     python, regex, regex-group     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing