0

I use regular expressions to find and replace text in some documents.

Im trying to find an Expression like
img.src.?picture.jpg".*?>

which finds a string for example like
IMG alt="" src="picture.jpg" width=461 align=baseline height=72>

Now I want to use that found string and save it in the replacement text in a comment like:
img.src.?newpicture.jpg".*?> COMMENT: OLDSTRING

How can I do this?

1

Enclose your find string in brackets
(img.src.?picture.jpg".*?>),

so you can refer to it using \1:
\1 COMMENT: OLDSTRING

  • I'm happy it works, please consider accepting it to mark your question answered. – Máté Juhász Dec 5 '16 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.