html - How do I replace one character with another but ONLY in href? -


i have hundreds of links in below format:

a href="../lorem_ipsum__"  title="dolor_sit amet" target="__blank" 

i need change _ (underscore) character - (hyphen), in href (title , target need remain unchanged).

i tried dreamweaver's 'find , replace', didn't succeed.

tick "use regular expression" in find , replace, search for:

(href="[^_"]*)_+([^"]*) 

and replace with:

$1-$2 

the first parenthesis group searches starts href=", characters except _ or ".

then have _ 1 or more times.

the second parenthesis group searches , stops before closing "

you can use groups $1 , $2 in replace.

here's interactive tutorial if want learn regular expressions (regex): http://regexone.com/


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -