Answers for "regex in rails"

1

rails where regex

@max_draw = Drawing.where("drawing_number ~* ?", '^A\d{4}$')
Posted by: Guest on July-03-2020
2

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/)
Posted by: Guest on October-27-2020

Browse Popular Code Answers by Language