Forum: Ruby Re: Scanning for more than one specific character with Strin

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-01-29 19:46
(Received via mailing list)
You can use


a.scan(/(s|k)/).

What's in between the '/  /' is called a "regular expression".
These regular expressions are used to find patterns in strings that  you
can describe in an approximate way.
They're a powerful tool.
To see what's available, look at

_http://www.regular-expressions.info/_
(http://www.regular-expressions.info/)
 .

Best regards,

Axel
This topic is locked and can not be replied to.