you have to escape them with \, or put them inside [..]strSeparator= @"\.";

解决方案 »

  1.   

    \.或者@"."
    "He is a boy\.Today is Tuesday\."

    @"He is a boy.Today is Tuesday."
      

  2.   

    strSeparator 和stringInput是作为参数传入的,而用这个函数的不是我本人哪,我这是写在一个control里的,所以我根本无法知道users会传入什么参数
      

  3.   

    you can do this first;
    str.Separator.Replace(".",@"\.").Replace("?",@"\?").. and so on
    then do you work
    Regex rg = new Regex(strSeparator);
    string[] strArr = rg.Split(stringInput);
      

  4.   

    reference:ms-help://MS.VSCC/MS.MSDNVS.2052/cpgenref/html/cpconregularexpressionslanguageelements.htm
      

  5.   

    another way,you can use the String.Split method to separater your stringmore reference:ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemStringClassSplitTopic.htmon this way,you only need convert the strSeparator to a char arry
      

  6.   

    我说过我不知道输入的参数是否是正则表达式中的特殊字符,所以这里肯定是需要一个判断,但是有没有什么是正则表达式类提供的判断方法的
    此外是不能用string.split方法做,因为string.split只能单个char地分,而我这里是允许根据一个字符串分割的
    比方说abcdbc允许用bc分割成a,d 的
      

  7.   

    按照你的要求
    你只有把正则表达式中的特殊字符
    全部都写到str.Separator.Replace(".",@"\.").Replace("?",@"\?").. and so on
    中去
    如果有,就加上\转译
    没有的话,也没有影响正则表达式的类中好像没有提供这种方法
    好像只能这么做了
      

  8.   

    参照windows提供的查找功能,是可以在查找框中输入.以查找句点的,我不知道他们是怎么处理的,总之我觉得强硬去replace是挺笨的方法的,而且总会有漏掉的特殊字符,比方说{3},{4}天哪,我觉得好多
      

  9.   

    呵呵
    你说的有道理
    我找了一下
    有一个方法Regex.Escape
    通过替换为转义码来转义最小的元字符集(\、*、+、?、|、{、[、(、)、^、$、.、# 和空白)。ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfsystemtextregularexpressionsregexclassescapetopic.htm
      

  10.   

    str.Separator.Replace(".",@"\.").Replace("?",@"\?").. and so on
    then do you work
    Regex rg = new Regex(strSeparator);
    string[] strArr = rg.Split(stringInput);