vtam wrote:
> 
> In the book "Internet Architectures" by Hassam, it said that ^1 ?[0-9]*$
> identify all the AS_paths that start with 1 and of length 2-that is, AS1 and
> its direct customs. But i think that ? means 0 or 1 occurrences, when it is
> 0, the expression can be equal ^1[0-9]*$,means any single AS number start
> with 1.
> Am I right? If so, which is the right answer of all the AS_paths that start
> with 1 and of length 2. Thanks.

^1 ?[0-9]*$  
  ^ 
  ^

Is that space yours or the books?  Broken apart, that regex matches 
(assuming standard egrep'ish metachars)

^       # beginning of line
1       # followed by the digit 1
(space) # followed by a space
?       # 0 or 1 of the preceding characters (in this case a space)
[0-9]   # a single digit within the range of 0-9
*       # 0 or more of the preceding characters, up to the end of
        # the pattern
$       # end of line char

So, is this equivalent to ^1[0-9]*$?  I don't think so.  Assuming 
that the pattern with a space was a typo, we are allowed an 
optional 1. Assuming it wasn't a typo, we are allowed the space 
character.  Neither of these options would be matched by your more 
restrictive pattern.  As for the specific pattern to match, you 
can't really say without knowing what you are matching with.

Different regex engines support different metachars.

_________________________________
FAQ, list archives, and subscription info: http://www.groupstudy.com/list/cisco.html
Report misconduct and Nondisclosure violations to [EMAIL PROTECTED]

Reply via email to