this is a ruby isogram checker: `p !/(.).*\1|\d/i` where do i put the word that needs to be checked? in ruby

To use the Ruby isogram checker p !/(.).*\1|\d/i, you can pass the word that needs to be checked as a string argument to the match method of the regular expression. Here's an example of how to do it:

main.rb
word = "isogram"
result = word.match(/(.)\1|\d/i)
p !result
60 chars
4 lines

In this example, the word variable holds the word that you want to check for being an isogram. The regular expression /(.)*\1|\d/iis used to check for any repeated characters or digits. Thematchmethod checks if the regular expression matches any part of the word. If a match is found, the method returns aMatchDataobject which evaluates to a truthy value. If no match is found, it returnsnilwhich evaluates to a falsy value. By negating the result with!, we get trueif the word is an isogram andfalse` otherwise.

So in the example above, if the word "isogram" is passed to the word variable, the output will be true.

gistlibby LogSnag