Programming Ruby 3.2 (5th Edition): p. 27:’match?’ is not synonymous to ‘=~‘

Hi @noelrappin,

first of all: It’s SO good to read an updated version of this book! Thanks for all the effort! :pray:

The text says:

Both strings and regular expressions have a match? method which is synonymous to the =~

While the two are very similar, there ist a difference in the return values (at least): ‚=~’ returns an integer or nil, ‘match?’ returns true or false.
See Class: Regexp (Ruby 3.1.2)



Thanks! We do mention the return value difference a little later in the chapter, but you are right that the text could be more accurate there.