Mega Code Archive
Categories
/
Ruby
/
String
The plus sign (+) operator indicates one or more of the previous pattern
phone = "(555)123-4567" phone.grep(/[\(\d+\)]?\d+-\d+/) # => ["(555)123-4567"]