View Single Post
  #5 (permalink)  
Old 04-23-2008, 08:24 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby Regular Expression

The =~ is the match operator.

Basically, what this code does is this:

In the variable johnsays you store a string, which in this case contains a string of chars indicating an hour in standard format also.The variable time stores the pattern to search for: in this case, 2 digits, followed by a semicolon, followed by another 2 digits.Notice you you need to put a forward slash / before the first \d and how you also need to a add a backwards slash after the last \d You need to do this each time you want to place the patterns to search for inside a variable.
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote