How to tell egrep which characters not to accept [duplicate]
I want to accept string that begins with s than the next character (whatever it is) must be conatined in script two more times (but not less, not more) and before this char cannot be a backslash. So:
s(.)[now some chars except (.) and not ending with \]\1[some chars but not (.) and not ending with \]\开发者_Python百科1[some chars but not (.)]
\1 and (.) and s are real part of regex
I don't think egrep is going to cut it.
You need a grep that can do lookahead assertions, here's why:
/^ s (.) (?:(?:\\.|(?!\1).)+\1){2} (?:\\.|(?!\1).)+ $/xs
/^             # Begin of string
     s
     (.)                # capture first char after 's'
     (?:                # Begin Grp
         (?: \\.          # begin grp, escaped anything
           | (?!\1).        # OR, any char that is not (.)
         )+               # end grp, do this more than once
         \1               # Followed by (.)
     ){2}               # End Grp, do this exactly twice
     (?: \\.            # begin grp, escaped anything
       | (?!\1).           # OR, anchar that is not (.)
     )+                 # end grp, do this more than once
 $/xs         # End of string, x and s modifiers
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论