Exact phrase in include?

I have a string that I check with include? There are two words in the
string that contains the same word of “design”. One is “design” the
other “designer”. How can I check for an exact phrase of “design”?

Pål Bergström wrote:

I have a string that I check with include? There are two words in the
string that contains the same word of “design”. One is “design” the
other “designer”. How can I check for an exact phrase of “design”?

string =~ /\bdesign\b/

Sebastian H. wrote:

Pål Bergström wrote:

string =~ /\bdesign\b/

Perfect. Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs