A regular expression can easily check whether a user entered something that looks like a valid phone number. In this case, backreferences to the captured values are used in the replacement text so we can easily reformat the phone number as needed.By using capturing groups to remember each set of digits, the same regular expression can be used to replace the subject text with precisely the format you want. Two other types of tokens used in this regular expression are character classes and quantifiers., composing a fairly comprehensive guide to validating and formatting North American and international phone numbers using regular expressions. Thus, the sequences that enclose the first group of digits match literal parenthesis characters.The regexes in these recipes are all pretty straightforward, but hopefully this gives an example of the depth you can expect from the book. Both are followed by a question mark, which makes them optional.See Recipes 3.5 and 3.15 for help implementing this regular expression with other programming languages. Character classes allow you to match any one out of a set of characters.This regular expression matches three groups of digits. ( # Capture the enclosed match to backreference 1... is another character class, one that allows any one of three separators.Russian crew members water the plant seeds and perform maintenance. "I don’t see future space crews leaving the Earth for long durations without having the ability to grow their own food," said Topham.
Image credit: NASA The harvested Mizuna sample kit is stored in a frozen return lab at Kennedy Space Center, Fla., hours after landing aboard space shuttle Discovery in April."This suggests the conservative water level we have been using for all our previous experiments may be below optimal for plant growth in microgravity," said Topham.