Created
December 2, 2010 13:18
-
-
Save hosiawak/725276 to your computer and use it in GitHub Desktop.
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
a = 'class="one"' | |
b = 'class="one two"' | |
c = '"other string"' | |
d = 'class="one two three"' # four five, any number of classes | |
e = 'id="one"' | |
Create a regular expression (r) in Ruby to achieve the following | |
a.r -> 'class="one_1"' | |
b.r -> 'class="one_1 two_1"' | |
c.r -> '"other string"' | |
d.r -> 'class="one_1 two_1 three_1"' | |
e.r -> 'id="one_1"' | |
etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment