PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Nov 23, 2014 8:05 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jul 03, 2012 4:27 pm 
Offline
Forum Newbie

Joined: Tue Jul 03, 2012 4:17 pm
Posts: 1
I'm trying to get this:
Quote:
sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,OTHERTEXT

sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext


but getting only this:
Quote:
sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,OTHERTEXT

sometext,sometext,sometext

sometext,sometext,sometext
sometext,sometext,sometext
sometext,sometext,sometext


/(\r\r)[^\1]*othertext/gis

please help


Top
 Profile  
 
PostPosted: Mon Jul 09, 2012 2:59 pm 
Offline
Forum Contributor
User avatar

Joined: Thu May 11, 2006 8:58 pm
Posts: 305
Location: Utah, USA
It may be easier to split the text on \r\r first and then run a regex on each chunk.


Top
 Profile  
 
PostPosted: Sun Jul 29, 2012 4:22 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Dec 15, 2011 2:40 pm
Posts: 85
Location: Nelson, NZ
This works in RegexBuddy, PCRE flavor:

Syntax: [ Download ] [ Hide ]
(?s)\r\n\r\n[^\r]+\r\n[^\r]+OTHERTEXT


I used \r\n because I'm on Windows, if you're on unix you can remove the three instances of \n.

The (?s) means "dot matches new line", works in PCRE, if you are using a different flavor, use the appropriate flag.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group