Skip to content

Instantly share code, notes, and snippets.

@asabirov
Created November 15, 2012 10:35
Show Gist options
  • Save asabirov/4077902 to your computer and use it in GitHub Desktop.
Save asabirov/4077902 to your computer and use it in GitHub Desktop.
Замена в строках черех regexp
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