FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » String Replacement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: String Replacement [message #172226 is a reply to message #172225] Sun, 06 February 2011 17:35 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Alec)

> I am not sure where to start on this on.
>
> I have a string as follows '<text
> identifier="3ecebe84-8ddd-475e-86ca-300b5298fc34">
> <value><![CDATA[12345]]></value>'
>
> The text identifier always remains the same ie. 3ece..... for each
> article. The string is much longer containing several different
> identifiers. I would like to be able to jump to the one shown, and
> then extract the CDATA value shown after ie. 12345. The length of this
> may change, so I need a way to extract the text between the second '['
> and first ']' . I hope that makes sense.

A regular expression might help, something like

/CDATA\[([^\]]+)/

It should match on the last '[' and then capture all following chars
which are not ']'.

But since this looks like XML, using DOM or SimpleXML might be an option
as well. Usually it's easier and the cleaner way to work with XML using
the appropriate tools.

Micha
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP server tag help
Next Topic: An extremely large hash lookup mechanism
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 16:04:37 GMT 2024

Total time taken to generate the page: 0.04899 seconds