You need a sed (1) version that uses regular expressions compatible with Perl, so you can do things like minimal match or with a negative look.
The easiest way to do this is to simply use Perl in the first place.
If you have an existing sed script, you can convert it to Perl using the s2p (1) utility. Note that in Perl, you really want to use $1 on the right side of the s/// operator. In most cases, \1 is grandfathered, but overall you want $1 there:
s/<blockquote.*?written by (.*?)<\/i>/[quote=$1]/g;
Notice that I removed the backslash from the front of the parens. Another advantage of using Perl is that it uses regular egrep-style regular expressions (like awk), rather than ugly grep-style (like sed) that require all the confusing (and inconsistent) backslashes everywhere.
Another benefit of using Perl is that you can use pairwise separable delimiters to avoid ugly backslashes. For instance:
s{<blockquote.*?written by (.*?)</i>} {[quote=$1]}g;
Another advantage is that Perl works well with UTF-8 (now the coding form of most websites) and that you can do multi-line matches without the extreme pain sed requires. For instance:
$ perl -CSD -00 -pe 's{<blockquote.*?written by (.*?)</i>}{[quote=$1]}gs' file1.utf8 file2.utf8 ...
-CSD allows treating stdin, stdout and files as UTF-8. -00 causes it to read the entire file into a single falling slurp, and /s makes the boundaries of the intersecting new line boundary as necessary.
source share