Created
October 14, 2014 22:50
-
-
Save chrisseaton/fbb15e94ceedfde588e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = 'foo<script src="jquery-2.1.1.js"></script>bar' | |
b = '<script src="jquery-2.1.1.js"></script>' | |
c = "Bootstrap\\'s JavaScript requires jQuery" | |
a.gsub(b, c) => "fooBootstrapbars JavaScript requires jQuerybar" | |
a.gsub(Regexp.quote(b), c) => "foo<script src=\"jquery-2.1.1.js\"></script>bar" | |
a.gsub(Regexp.quote(b), Regexp.quote(c)) => "foo<script src=\"jquery-2.1.1.js\"></script>bar" | |
a.gsub(b, Regexp.quote(c)) => "fooBootstrap\\'s\\ JavaScript\\ requires\\ jQuerybar" | |
I want: | |
a.replace(b, c) => 'fooBootstrap\\'s JavaScript requires jQuery</script>bar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment