in reply to Pattern Matching and replacement
Note that it assumes the tag already has a value attribute (either set or empty).my $newvalue = "foobar"; foreach (<DATA>) { s/(<input .+? value=["']).*?(["'].*?>)/$1$newvalue$2/; print; } __DATA__ <input type="text" value=""> <input type="password" name="moo" value="fish" /> <input type="text" value=''/>
|
|---|