At the moment I am using this line to take a string and extract only the letters from it:
string.scan(/[a-zA-Z]/).to_s
How do I modify this so that the underline character, "开发者_StackOverflow社区_", is also included? Thanks for reading.
Add it within the brackets (the range IIRC).
string.scan(/[a-zA-Z_]/).to_s
Alternative version
string.scan(/[a-z_]/i).to_s
精彩评论