#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    20
    Rep Power
    0

    PHP, Regex and multiple html edits


    What i am trying to do is to edit multiple html pages with a php script. However what i do not know is how to implement Regex to do what i need.

    i have a javascript code that replaced a tag="such and such" to onclick="tag'such and such';" however find and replace only replaced the first part leaving the following:

    onclick="tag'such and such"

    i need to parse the DOM and add '; before the "

    onclick="tag'(.*?)" search finds even those that do not require changes due to the generality of the (.*?) command.

    how can i find all the ones that do not have '; and replace with preg_replace .


    Assistance highly appreciated
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1100
    Welcome to Dev Shed.

    Thread moved from PHP to the "new" Regex ...
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,128
    Rep Power
    9398
    Would be better to fix your expression instead of trying to throw another one at it.

    What expression/code do you have?

IMN logo majestic logo threadwatch logo seochat tools logo