请问这个表达式代表什么:"[a-zA-Z]+\\.(?<extension>\\w+)"
主要是(?<extension>\\w+)这句话是什么意思?以及整个表达式都匹配什么样的字符串哪?请给出几个例子!!谢谢》》》

解决方案 »

  1.   

    特定字符或转义序列 含义 样例  匹配的样例 
    ^  输入文本的开头 ^B  B,但只能是文本中的第一个字符 
    $  输入文本的结尾 X$ X,但只能是文本中的最后一个字符 
    .  除了换行字符(\n)以外的所有单个字符 i.ation isation、ization 
    *  可以重复0次或多次的前导字符 ra*t rat、raat等 
    +  可以重复1次或多次的前导字符 ra+t rt、rat、raat等 
    ? 可以重复0次或1次的前导字符 ra?t  只有rt和rat匹配 
    \s  任何空白字符  \sa  [space]a,\ta,\na(\t和\n与C#的\t和\n含义相同) 
    \S  任何不是空白的字符 \SF aF,rF,cF,但不能是\tf 
    \b  字边界 ion\b 以ion结尾的任何字 
    \B  不是字边界的位置  \BX\B  字中间的任何X extension附加信息。
      

  2.   

    MultiCharEsc ::= '.' | ('\' [sSiIcCdDwW])
    字符序列 等效字符类 
    . [^\n\r] 
    \s [#x20\t\n\r] 
    \S [^\s] 
    \i 初始名称字符,匹配字母 | '_' | ';'. 
    \I [^\i] 
    \c 名称字符(由 NameChar 匹配的那些字符)的集合。 
    \C [^\c] 
    \d \p{Nd} 
    \D [^\d] 
    \w [#x0000=#x10FFFF]-[\p{P}\p{Z}\p{C}](除标点、分隔符和其他字符的集合之外的所有字符)。 
    \W [^\w] 
      

  3.   

    在整个表达式中的?是匹配的哪个表达式亚?以及extension具体是干什么的?在这里有什么用哪?
    谢谢!!!!
      

  4.   

    估计是文件名的匹配,(?<extension>....)命名组,将括号内的匹配命名为extension。
    如果是匹配文件名,那么这里是将文件的扩展名部分命名为extension。
      

  5.   

    [a-zA-Z]+\\.(?<extension>\\w+)'[a-zA-Z]+': Match a single character present in the list below 
         '+': Between one and unlimited times, as many times as possible, giving back as needed (greedy) 
         'a-z': A character in the range between "a" and "z" 
         'A-Z': A character in the range between "A" and "Z" 
    '\\': Match the character "\" literally 
    '.': Match any single character that is not a line break character 
    '(?<extension>\\w+)': Match the regular expression below and capture its match into backreference with name "extension" 
         '\\': Match the character "\" literally 
         'w+': Match the character "w" literally 
              '+': Between one and unlimited times, as many times as possible, giving back as needed (greedy) 
      

  6.   

    '\\': Match the character "\" literally 
    '.': Match any single character that is not a line break character