Created
December 1, 2010 13:43
-
-
Save rmm5t/723487 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
$s = 'Foo Bar A100B/ A101B/ A120B/'; | |
$s =~ s/(?:Foo Bar)? ([^\/]*)\//Foo Bar $1, /g; | |
$s =~ s/, $//; | |
print $s; | |
# Foo Bar A100B, Foo Bar A101B, Foo Bar A120B |
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
s = "Foo Bar A100B/ A101B/ A120B/" | |
s = s.gsub(/(?:Foo Bar)? ([^\/]*)\//, "Foo Bar \\1, ").sub(/, $/, "") | |
puts s | |
# Foo Bar A100B, Foo Bar A101B, Foo Bar A120B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment