--- Bob Sawyer <[EMAIL PROTECTED]> wrote:
> In the following regex, what does the "si" do?
> 
>    preg_match("'<$itemtag url=(.*?) />'si")

The "i" says that the Regular Expression should ignore capitalization in the
match string.  The "s" allows a match to span multiple lines.  Normally the
RegEx engine stops when it finds a newline character.


> As I wrote last night, I'm trying to parse the attributes of the
> "enclosure" tag from an RSS feed. The tag looks like this:
> 
>    <enclosure url="foo.com" length="12345" type="audio/mpeg" />
> 
> The regex above gives me:
> 
>    url="foo.com" length="12345" type="audio/mpeg"
> 
> However, all I want is the contents of the URL attribute:
> 
>    foo.com
> 
> How do I write the regex above to do that?


It seems to me that you might have better success using some of the XML parser
classes for this purpose.  Your technique is dependent on items being in a
precisely consistent order.  One change on the part of the XML source and your
script won't work anymore.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Spring Semester Begins Jan 31 -- New Classes Start Every Few Weeks.


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to