In ruby, I read some of the operators, but I couldn't find =~
. What is =~
for, or what does it mean? The program that I saw has
regexs = (/\d+/)
a = somestring
if a =~ regexs
I think it was comparing if somestring
equal to digits but, is there any other usage, and what is the proper definition of the =~
operator?
ruby =~ operator
, this question is the first relevant hit in Google, Yahoo, Bing, and DuckDuckGo in my tests, which also explains why this one has more votes.