Link to home
Start Free TrialLog in
Avatar of fox_statton
fox_statton

asked on

Simple regex not working

$html = "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">";
$html = preg_replace('/form/si', 'f1', $html);


Anyone have any idea why this isnt working?
ASKER CERTIFIED SOLUTION
Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you dont want to replace the form-tag itself, only the id and name try using
$html = "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">";
$html = preg_replace('/form(\d+)/si', 'f\1', $html);
What result are you getting and what were you expecting?