KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to match an md5 checksum in a regular expression in a Ruby (actually Rails) program. I found out somewhere that I can match hexadecimal strings with \h sequence, but I can't find the link anymore. I'm using that sequence and my code is working in Ruby 1.9.2. I can make it working even under plain IRB (so it's not a Rails extension). ruby-1.9.2-p180 :007 > "123abcdf" =~ /^\h+$/; $~ => #<MatchData "123abcdf"> ruby-1.9.2-p180 :008 > "123abcdfg" =~ /^\h+$/; $~ => nil However my IDE mark that expression as wrong and I can't find any reference which cites that sequence. Is the \h sequence legal in Ruby Regex under any environment/version or should I trust my ide and replace it with something like [abcdef\d] ?
Tags (comma-separated)
Save Edits
Cancel