|
Posted by Rik Wasmus on 12/01/07 02:10
On Sat, 01 Dec 2007 01:03:07 +0100, <ofuuzo1@yahoo.no> wrote:
> Hi,
> I am new to php. I have text files each containing some metadata. I
> would like to use preg_replace to remove some of the fields in each
> text file. Some contents of a field can go over several lines. How can=
> I do it using preg_replace?
>
> Thanks in advance
> Ofuuzo
>
> <?xml version=3D"1.0" encoding=3D"utf-8" standalone=3D"no" ?>
> <dublin_core schema=3D"dc">
> <dcvalue element=3D"contributor" qualifier=3D"advisor">Test, Testman=
> several lines several lines several lines several lines several
> lines several lines several lines several lines several lines
> several lines several lines several lines several lines </
> dcvalue>
> <dcvalue element=3D"date" qualifier=3D"issued">2007-11-15</dcvalue>
> <dcvalue element=3D"format" qualifier=3D"extent">4869077 bytes</
> dcvalue>
> <dcvalue element=3D"format" qualifier=3D"mimetype">application/pdf</=
> dcvalue>
> <dcvalue element=3D"language" qualifier=3D"iso">nob</dcvalue>
> <dcvalue element=3D"subject" qualifier=3D"courseID">NOR-3920</dcvalu=
e>
> <dcvalue element=3D"subject" qualifier=3D"departmentID">6640</dcvalu=
e>
> </dublin_core>
This isn't just text, it's XML. You really get a benefit from using one =
of =
the several possibilities/extentions mentioned in the manual. DOMXML wou=
ld =
be my choice for this: <http://www.php.net/domxml>
If you really want it using a regex (which is possible, but inflexible a=
nd =
cumbersome), please inform us which field you want the have removed.
-- =
Rik Wasmus
[Back to original message]
|