regex - Matching zero or more characters in sed -


i practicing commands using sed when confused output of following command:

echo 'first:second' | sed 's_[^:]*_(&)_g' 

my question is: why command wrap string "first" , "second" in parentheses?

shouldn't colon wrapped since specified "zero or more non-colons" in regex condition?

please clarify.

you use

[^:] 

which searches characters except :. experience normal comportment.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -