[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-windows
Subject:    [PHP-WIN] Problems with fscanf
From:       "=?UTF-8?Q?German_Piqu=C3=A9?=" <extremdur2 () gmail ! com>
Date:       2006-09-26 12:50:21
Message-ID: 80f1761b0609260550t79d7ffbaue157c9761b6d4a6 () mail ! gmail ! com
[Download RAW message or body]


All of it :P

I only want to delete the initial and final tags in order to unify various
archives with the sames patterns. To work with this archives I need to put
it one by one, so I thought that I can unify all in only one archive. I'm
doing it in php for my partners, because i'm not the only one with the
problem so i want this utility to work in any pc.

But i managet to solve this with fgetc :) See my other mail :)

Thanks anyway

2006/9/26, Niel Archer <niel@catweasel.org>:
>
> Hi
>
> First, if you're parsing XML files, I'd suggest using the XML modules to
> do so.
>
> I'm not sure what you're attempting.  From the line:
>
> <ARTIST>The Communards</ARTIST>
>
> are you trying to retrieve  all of it, or just "The Communards"?  If the
> latter then try a regex and not fscanf
>
> This is a little loose on the tag matching but should do the job:
>        $pattern = '/<\w+>(.+)<\/\w+>/';
>        preg_match($pattern, $line, $matches);
> returning the untagged data into $matches[1] and the tagged data into
> $matches[0]
> This assumes that you have only a single tagged entry per line.
>
>
> Niel
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic