Evaluating an expression in a RegExp
Horray! I can evaluate the right side of a regular expression!
e Evaluate the right side as an expression.
Wow.
Horray! I can evaluate the right side of a regular expression!
e Evaluate the right side as an expression.
Wow.
Well, defunkt and I were working on the oz script, and we found a little bug, which he fixed like this (I thought this was pretty slick)
irb(main):058:0> host = "modzer0.cs.uaf.edu" => "modzer0.cs.uaf.edu" irb(main):059:0> domain = host =~ /([^\/]+)\/(.+)/ ? "#{$1}#{':80'}/#{$2}" : "#{host}#{':80'}" => "modzer0.cs.uaf.edu:80" irb(main):060:0> host = "modzer0.cs.uaf.edu/hank-typo" => "modzer0.cs.uaf.edu/hank-typo" irb(main):061:0> domain = host =~ /([^\/]+)\/(.+)/ ? "#{$1}#{':80'}/#{$2}" : "#{host}#{':80'}" => "modzer0.cs.uaf.edu:80/hank-typo"
I need to make sure to brush up on my RegExp Skillz before I get into the real world.