Search and replace global modifier
- by mrucci
Is there any reason why non-global/first-occurrence substitution is the default in many text editing programs (vim, sed, perl, etc.)?
I am talking about the /g flag of search and replace commands like:
:s/pan/focaccia/g # in vim
sed 's/sfortuna/fortuna/g' # with sed
that will substitute every occurrence of the search pattern with…