Hi,
$txt = "http://yahoo.com/"; $txt2 = eregi_replace("[h][r][e]f[=][\"][.][.][/]", "href=\"$txt", $txt2 );
I want to replace "../" with the $txt1 in any anchor. It works fine if there is no space inbetween "href" and "=". I want to check for spaces, tabs, newline.
Can anyone help?
How about this
$txt2 = str_replace("../", $txt1, $txt)
or use your code but before use
$replace_this =Array('\n', '\t', ' '); $with_this =""; $txt2 = str_replace($replace_this, $with_this, $txt);
The regular expression can be tidied up a huge amount also:
"href[[:space:]]*=\"\.\./"
Thanks Weedpacket, it worked!