regex - sed - $ in Zeichenauswahl -


i have sed expression replace "$about" "about"

sed 's/$about/"about"/g 

i want change it, $about replaced, when followed whitespace or end of line. whitespaces works:

sed 's/\($about\)\([[:space:]]\)/"about"\2/g' 

wondefull! end of line? tried inserting $:

sed 's/\($about\)\([[:space:]$]\)/"about"\2/g' 

but not work! \$ not work. when insert $ without [[:space:]], works (but eol, not whitespaces of course).

i missing something, not? please tell me is.

you need use alternation otherwise $ literal $ inside character class:

sed -e 's/($about)([[:space:]]|$)/about\2/g' 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -