Last active
August 29, 2015 14:02
-
-
Save vladimir-e/77c13df1379b5ceeb984 to your computer and use it in GitHub Desktop.
capture regex pattern with ruby gsub
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
str = "number 5" | |
str.gsub(/number\ (\d+)/, '#\1') | |
# => "#5" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment