Use of $1-$9 in replace

Tool for Search and Replace across multiple files.
Post Reply
User avatar
Tim

Use of $1-$9 in replace

Post by Tim »

Can you give a find and replace example using $1-$9. I can't get it to work the way I think it should.
User avatar
DV

Post by DV »


The capturing groups are defined by parentheses ().

example -

RegEx - <img src="(.*?)">
Replace - <img src="$1" alt="$1">

Input Text = <img src="test.jpg">
Result = <img src="test.jpg" alt="test.jpg">
User avatar
Tim

Post by Tim »

Thanks DV.

The () in the search field was what I was missing. I will try it later tonight.
Post Reply