PHP REGEX - text to array by preg_split at line break

Posted by aSeptik on Stack Overflow See other posts from Stack Overflow or by aSeptik
Published on 2010-04-26T19:41:07Z Indexed on 2010/04/26 20:03 UTC
Read the original article Hit count: 418

Filed under:
|
|
|

Hi All!

EDITED:

need help on split Array

array example:

 $text = array (

           [0] =>
            TEXT1:some normal text
            TEXT2:some long text here, and so on... sometimes 
            i'm breaking down and...
            TEXT3:some normal text
            TEXT4:some normal text

           [1] =>
            TEXT1:some normal text
            TEXT2:some long text here, and so on... sometimes 
            i'm breaking down and...
            TEXT3:some normal text
            TEXT4:some normal text
        )

ok, now by using

preg_split( '#\n(?!s)#' ,  $text );

i get

[0] => Array
        (
            [0] => some normal text
            [1] => some long text here, and so on... sometimes
            [2] => some normal text
            [3] => some normal text
        )

As you can see the [1] Element of the Array is cutted off!

i want keep this line entirely:

some long text here, and so on... sometimes i'm breaking down and...

what Regex can get the entire line and also split at line break!?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex