pspfreak101 Posted April 15, 2011 Share Posted April 15, 2011 Ok I'm not sure how to approach this one I want to swap the value thats in a span in put it in a text field. My regex /<span>.+[0-9]<\/span>/g Example: My data looks like this <span class="SomeClass"> <span>5000</span> </span> I want to remove the span and have the value in a text field like this <input type="text" name="score" value="5000" /> Quote Link to comment Share on other sites More sharing options...
.josh Posted April 15, 2011 Share Posted April 15, 2011 $subject = preg_replace('~(<span class="SomeClass">)\s*<span>([0-9]+)</span>~is','$1<input type="text" name="score" value="$2" />',$subject); This could probably stand to be more flexible if you gave more details about the content that is matching... Quote Link to comment Share on other sites More sharing options...
pspfreak101 Posted April 15, 2011 Author Share Posted April 15, 2011 Thank you, this worked perfectly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.