Interesting Bit of Code

By: Johnathon Wright on: February 11, 2020

Whenever I see screen shots of code, I think that my code isn't interesting enough to create a visual. I do tend to write small bits that are simple-looking (to my eyes.) So when writing this bit, I thought I'd record it for posterity in case I wanted something in the future.

def looks_numeric?
  number = "-?\\s*\\d{0,}[\\.\\,]{0,2}(\\d{1,})?"
  numeric_value_pattern = /^\s*#{number}\s*$/
  numeric_range_pattern = /^\s*#{number}\s*-\s*#{number}\s*$/

  numeric_value_pattern =~ self ||
    numeric_range_pattern =~ self ||
      Inequality.pattern =~ self
end




Comments:

Just checking that you are human. What would be the result of this code?

a = 3*(4/2); b = 1; a+b

snkrspop said: Calling all shoe lovers! Are you looking for that perfect shoe quote that expresses your deep love of shoes? Or looking for the best Instagram caption for shoes for your footwear obsessed audience? If so, you can grab one of my favorite quotes about shoes from my post, below. Replica Jordan 4

Jane Grant said: WPS website is a true treasure for college students who are short of time for accomplishment of difficult academic projects. Detailed reviews, based on personal experience enlighten the most critical facts.

Jack said: how does partial moving work? First, you will need to find a reliable moving company that offers this service. You can search online, ask for recommendations from friends or family, or check with local moving associations. https://www.youtube.com/watch?v=5LiWaNacotc
Back