I have relatively moderate experience with PHP but preg_replace is not one of my strong points. I need HELP with the following:
I have 5 [HTML]<div>[/HTML] tags whose values are sent to a PHP page that creates a textbox with the initial value being whatever was in the posted div (posted using AJAX).
Part of the innerHTML on the div is the link that activates the ajax function:
Expand|Select|Wrap|Line Numbers
- ... [<a href="#" onClick="edit('div1', 'advert');">edit</a>]
- ... [<a href="#" onClick="edit('div2', 'content');">edit</a>]
I would like to strip the text link with the leading dots. I thought preg_replace would be a solution here so I wrote the following (obviously horrible bad)
Expand|Select|Wrap|Line Numbers
- $pattern = '[... \[<a href="#" onclick="edit(\'^[a-zA-Z0-9]\', \'^[a-zA-Z0-9]\');">edit</a>
- [PHP]$replace = ' ';
- [PHP]$newValue = preg_replace($pattern, $replace, $divContent);
Thanks