We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Before running:
def alphabet_position(str) str.scan(/\[a-z]/i).map { |c| c.ord & 0b11111 }.join(' ') end def assert_equals(actual, expected) raise RuntimeError, "#{actual}\n#{expected}", caller unless actual == expected end assert_equals( alphabet_position("The sunset sets at twelve o' clock."), "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11" ) assert_equals( alphabet_position("The narwhal bacons at midnight."), "20 8 5 14 1 18 23 8 1 12 2 1 3 15 14 19 1 20 13 9 4 14 9 7 8 20" )
After running:
def alphabet_position(str) str.scan(/\[a-z]/i).map { |c| c.ord & 0b11111 }.join(' ') end def assert_equals(actual, expected) raise RuntimeError, "#{actual}\n#{expected}", caller unless actual == expected end assert_equals( # ~> RuntimeError: \n20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11 alphabet_position("The sunset sets at twelve o' clock."), "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11" ) assert_equals( alphabet_position("The narwhal bacons at midnight."), "20 8 5 14 1 18 23 8 1 12 2 1 3 15 14 19 1 20 13 9 4 14 9 7 8 20" ) # ~> RuntimeError # ~> # ~> 20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11 # ~> # ~> program.rb:9:in `<main>'/Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/ /Users/josh/.gem/ruby/2.5.1/gems/parser-2.5.1.2/lib/parser/builders/default.rb:1635: warning: regular expression has ']' without escape: /\[a-z]/
The text was updated successfully, but these errors were encountered:
NOTE: The regex accidentally escaped the character set (b/c it used to be /\w/ and I forgot to take out the escape)
/\w/
Sorry, something went wrong.
No branches or pull requests
Before running:
After running:
The text was updated successfully, but these errors were encountered: