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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -