ruby regexp match all
# use scan
"hello".scan(/l/)
ruby regexp match all
# use scan
"hello".scan(/l/)
ruby match word in string
text = "A regular expression is a sequence of characters that define a search pattern."
puts 'Found "A" at the beginning of the string.' if text.match(/^A/)
puts 'Found "O" at the beginning of the string.' if text.match(/^O/)
puts 'Found the string "character".' if text.match(/character/)
puts 'Found the word "character".' if text.match(/character\b/)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us