PCRE regex to sed regex -


first of sorry bad english. i'm german guy.

the code given below working fine in php:

$string = preg_replace('/href="(.*?)(\.|\,)"/i','href="$1"',$string); 

now t need same sed. thought should be:

sed 's/href="(.*?)(\.|\,)"/href="{$\1}"/g' test.htm 

but gives me error:

sed: -e expression #1, char 36: invalid reference \1 on `s' command's rhs

sed -e 's|href=\"\(.[^"][^>]*\)\([.,]\)\">|href="\1">|g' file 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -