G
Guy
I found this example, which you may recognize, they start off with data,
notice the indentation:
Skipper
blue_shirt
hat
Professor
sunscreen
water_bottle
Gilligan
red_shirt
hat
Then, as they read the lines of data, they want to determine if the data is
the person's name, or an item belonging to that person. They use the
following:
if (/^(\S.*)/) {...
This will determine whether or not there is a non-white space (person name)
at the begining of the line. Would the following achieve the same, in this
case? If so, is there an advantage to their pattern?
if (/^\S/) {...
Thanks,
Guy
notice the indentation:
Skipper
blue_shirt
hat
Professor
sunscreen
water_bottle
Gilligan
red_shirt
hat
Then, as they read the lines of data, they want to determine if the data is
the person's name, or an item belonging to that person. They use the
following:
if (/^(\S.*)/) {...
This will determine whether or not there is a non-white space (person name)
at the begining of the line. Would the following achieve the same, in this
case? If so, is there an advantage to their pattern?
if (/^\S/) {...
Thanks,
Guy