Search notes:

vim script: substitute

substitute({expr}, {reg-exp}, {replace-text}, {flags})

Example

"
" ..\run_.bat substitute
"
redir > substitute.out

let s:txt = 'foo BAR baz'

set  noic

let  s:S1 = substitute(s:txt,   'bar', '___', '' )
echo s:S1 
" foo BAR baz

set  ic 

let  s:S2 = substitute(s:txt,   'bar', '___', '' )
echo s:S2
" foo ___ baz

let  s:S3 = substitute(s:txt,   'bar', '___', 'i')
echo s:S3
" foo ___ baz

let  s:S4 = substitute(s:txt, '\Cbar', '___', 'i')
echo s:S4
" foo BAR baz

redir END

q
Github repository about-vim, path: /vimscript/functions/substitute.vim

See also

The :substitute command.
Vim: built in functions
VIM script

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758184747, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/vim/script/vimscript/functions/substitute(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78