To include hyphenated words in the regex pattern, you can modify it as follows:
main.rb67 chars4 lines
In this updated pattern, (.)
matches any character except a newline and captures it. (?:\1|-|\d)
is a non-capturing group that matches either the captured character (\1
), a hyphen -
, or a digit \d
.
So, with the modified regex pattern, the resulting match will include hyphenated words as well.
gistlibby LogSnag