Wednesday, October 23, 2013

Literal Regexes

Sometimes I will want to do a simple search and replace on a string that contains characters that I have to escape, eg. for '$foo->{bar}[0]', I would have to use '\$foo->{bar}\[0\]'. I try not to use the various magic types, because it's difficult to remember them, and it's recommended to not change the default magic setting. Is there a way I can do 's/$foo->{bar}[0]/foobar/' and have it not treat any characters as special, ie. treat the search string as all literal?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment