I have made this javascript where I can strReplace:
Code JavaScript:$('#update').click(function() { $("#mif").contents().find("#strDiv").each(function() { var s = '<?=$str;?>', sel = document.getElementById("tags"), re; for (var i = 0, len = sel.options.length; i < len; i++) { if (sel.options[i].selected) { re = new RegExp(sel.options[i].text.replace("<", "<\\/?").replace(">", "[^>]*?>"), "gi"); s = s.replace(re, ""); } } $("#mif").contents().find("#strDiv").html(s); }); });
With this I can replace and update an $str inside an iFrame without having to refresh and it works like a charm...
But what if I want to preg_replace like I can in PHP like this:
I have 2 input fields with id pregmatchFrom and pregmatchTo. Now I want to be able to do the exact same thing as with the strReplace, but dont' know where to begin... Can somebody please help ;-)PHP Code:$results = preg_match_all('/(<h1>)(.*)(<\/h1>)/', $str, $arr);
Thanks in advance ;-)



Reply With Quote
Bookmarks