[thelist] php regexp help (or some other solution maybe..)

Tom Dell'Aringa pixelmech at yahoo.com
Tue Dec 31 12:41:01 CST 2002


--- Kelly Hallman <khallman at wrack.org> wrote:
> To remove the unwanted header information this actually seems to be
> the
> easiest, fastest, least error-prone method*:
>
> This regex uses a positive lookahead:
> list($head,$body) = preg_split("/(?=<\?xml)/",$inputdata,2);

Sorry if this is a stupid question, but how do I use it (i really
have no understanding of regex at all) within this code block:

$filename = "dump.xml";
$handle = fopen($filename,'w+');
$string = $response;
fputs($handle, $string);
fclose($handle);

I'm assuming my $string matches your $inputdata...

> You could omit the limit argument to preg_split, if you wanted to
> split at every XML PI, but this example just assumes two parts.

As if I knew what that meant!

> * Let's see if that improves response :)

Actually the reason I didn't try your solution earlier was because I
think I had the other one running already..would your solution still
have the same effect as the block of data that you mentioned?

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list