Created
November 15, 2012 10:35
-
-
Save asabirov/4077902 to your computer and use it in GitHub Desktop.
Замена в строках черех regexp
This file contains 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
str = "$24.99 per seat" | |
str[/\$\d+(?:\.\d+)/] = "$9.99" | |
p str # "$9.99 per seat" | |
str[/\$\d+(?:\.\d+)(\b)/, 1] = " USD" | |
p str # "$9.99 USD per seat" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment