# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/^(.*?(?:@heroImageURL\s*=\s*""[^""]+"".*?){1}@heroImageURL\s*=\s"")[^""]+(?="")/$1http:\/\/www.google.com\/1.jpg/s;t' <<< " IF @brandName == \"A\" THEN
set @heroImageURL = \"http://www.image.com/a9230239u230.jpg\"
set @productImageURL = \"http://www.image.com/A29200923.jpg\"
ELSEIF @brandName == \"B\" THEN
set @heroImageURL = \"http://www.image.com/b2389823u238.jpg\"
set @productImageURL = \"http://www.image.com/B22392029.jpg\"
ELSEIF @brandName == \"C\" THEN
set @heroImageURL = \"http://www.image.com/c23892389289.jpg\"
set @productImageURL = \"http://www.image.com/C49309934.jpg\"
ELSEIF @brandName == \"D\" THEN
set @heroImageURL = \"http://www.image.com/d23423892833.jpg\"
set @productImageURL = \"http://www.image.com/D09349409.jpg\"
ELSEIF @brandName == \"E\" THEN
set @heroImageURL = \"http://www.image.com/e22823889899.jpg\"
set @productImageURL = \"http://www.image.com/E22092309.jpg\"
ELSE
set @heroImageURL = \"http://www.image.com/e22823889899.jpg\"
set @productImageURL = \"http://www.image.com/E22092309.jpg\"
ENDIF"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html