SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: regex help

  1. #1
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)

    regex help

    Hi,

    I need to replace:
    <a href="http://xxxxx/asdfasdf/#anchor" class="relativePath">Name</a>
    with
    <a href="#anchor" class="relativePath">Name</a>

    If 'class="relativePath"' is between '<a' and '</a>'

    I don't expect people here to be my regex writers - but don't know where to start.

    Any clues?

    Thanks,

  2. #2
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first part :
    if(pgreg_match('/<a [^>]*class="relativePath"[^>]*>/'))
    {
    We have found the good class
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •