(01-14-2010, 07:44 PM)trilobyte- Wrote: I'm not sure about regular expressions, but I heard my mate is making a tut.
And for replacing in a strign, I think it's something using GSUB.
Like;
Would change J to X, making it Xordan.Code:puts "Jordan".gsub("J", "X")
I think that's how it works anyway, I don't know, try it. Mark (Wolskie) taught me that
Yes that worked, thanks!
And about the regular expressions, they work with the same function...
This code will convert every letter lowercase and uppercase from a-z with to the number 0...
Code:
puts "Jordan".gsub(/[A-Za-z]/, "0")