Javascript Replace Regex

by admin on October 10, 2010

javascript replace regex

javascript replace regex Questions


PHP find and replace issue using str_replace. Need help today please!?

Ok so the concept of this is simple but I can’t get the regex to work.

I’ll make this as simple as possible: I need to find this tag ???? and replace it (Or better yet, just the text in between this particular span) with a new value. Its kind of like doing innerHTML with Javascript just doing it in PHP.

What I got is this:

$text = “This is the area that has the span in it look… ){1}[ws$.,]+(){1}/i”;
$swap = ($regex,”Use this now”,$text);
It needs to be PHP version 4.0 -> 5.0 sorry. No 5.0+ PHP please.

function replace( $text, $replace, $begin = '‘, $end = ‘‘ )
{
$b = 0;
while( false !== ( $b = strpos( $text, $begin, $b ) ) )
{
$b += strlen( $begin );
if( false !== ( $e = strpos( $text, $end, $b ) ) )
{
$text = substr( $text, 0, $b ) . $replace . substr( $text, $e );
}
}
return $text;
}

echo replace ( ‘Let us replace this text, ok? and this text once more.’
, ‘Use this now’
), PHP_EOL;

javascript replace regex Videos

Google I/O 2009 – Programming With and For Google Wave

It has never been easier to shop for javascript replace regex,

So run don”t walk and pick up javascript replace regex at bargain

prices!

Leave a Comment

Next post: