rwhubbard996
asked on
Find & Replace using regular expressions
I'll admit regular expressions are an egnigma for me.
I'm trying to find every thing starting with .php in tage like this:
<a href="<?=$search_page?>.ph p?ser=engr 1">
<a href="<?=$search_page?>.ph p?ser=engr 2">
<a href="<?=$search_page?>.ph p?ser=dia_ ring">
And dump it so they all look like this:
<a href="<?=$search_page?>">
Any suggestions?
Thanks,
Roger
I'm trying to find every thing starting with .php in tage like this:
<a href="<?=$search_page?>.ph
<a href="<?=$search_page?>.ph
<a href="<?=$search_page?>.ph
And dump it so they all look like this:
<a href="<?=$search_page?>">
Any suggestions?
Thanks,
Roger
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you like the tool. Have fun and thanks for the A.
ASKER
Already used it!
$file_name = preg_replace("/-+/","-",$f ile_name);
to replace multiple -'s of any number 1 and up with just 1
$file_name = preg_replace("/-+/","-",$f
to replace multiple -'s of any number 1 and up with just 1
ASKER
or
$file_name = preg_replace("/^-{2,}/","- ",$file_na me);
replace only when 2 or more - 's
$file_name = preg_replace("/^-{2,}/","-
replace only when 2 or more - 's
Don't forget that there are free online resources like http://www.quanetic.com/regex.php. As well as gui tools like Kregexpeditor (http://www.blackie.dk/KDE/KRegExpEditor/)
ASKER