Reputation: 12367
could somebody please tell me what the following expressions means:
\d{6,8}
As far as I know it's a regular exp
Upvotes: 0
Views: 1683
Reputation: 14685
It means between 6 to 8 numbers in a row.
You use curly braces to describe how many of the previous character you want to look for. Entering a single number, like {3} means 3 in a row. Adding a second number changes this into min/max.
http://www.regular-expressions.info is the best site on the web for learning about regular expressions.
Upvotes: 1
Reputation: 12819
it matches between 6 and 8 sequential numeric digits.
\d
is equivalent to the character class [0-9]
, and the {,}
notation specifies an exact number of times that a pattern has to match.
Upvotes: 2
Reputation: 6553
Between 6 and 8 numeric digits.
(As it's not anchored to boundaries or start & end of string, it would also match between 6 and 8 digits within a longer series of digits - for instance, it will match 123456
, 1234567
, 1234678
, but also the first 8 digits of 123456789
.)
\d
is a character class - it could also have been written as [0-9]
. The {}
part is a repetition count; it could be a single number, e.g. {6}
, or, as in this case, a range - so the {6,8}
means "the previous thing, repeated between 6 and 8 times".
Upvotes: 5