hello, what am i doing wrong here? it is not working $fullpage = preg_replace("#<td class=\"mod\">(.+?)\ </td>#i", "<td class=\"mod\">You are not allowed to view here </td>", $fullpage); PHP: thanks
You specified the pattern to match against, but you didn't specify what to replace it with. Look at the doco for preg_replace here.
I match against: <td class=\"mod\"> </td> PHP: replace with <td class=\"mod\">You are not allowed to view here </td> PHP: is this not how to do?
Sorry I must get my eyes checked Can you confirm what you want to match? In your last post it seems like you're matching a td tag with class "mod" that contains one whitespace character. In your regex it's matching also a td tag with class "mod" that contains at least one of any character followed by one whitespace character.
I am trying to match <td class=\"mod\"> </td> PHP: Any td tag with mod class (there is a space just before the closing td tag) and replace it with <td class=\"mod\">You are not allowed to view here</td> PHP:
In that case just remove the part with the brackets in your regex: (.+?) BTW, in any case, question mark after '.+' is redundant.