解决方法
来自man expr:
expr1 : expr2 The ``:'' operator matches expr1 against expr2,which must be a regular expression. The regular expression is anchored to the beginning of the string with an implicit ``^''. expr expects "basic" regular expressions,see re_format(7) for more informa- tion on regular expressions.
@只是@,因为它在正则表达式中没有特殊含义.从而,
expr _@foo@ : "_@[^@]*@"
expr _x@foo@ : "_@[^@]*@"
如果您不熟悉正则表达式,则示例中给出的是:下划线(_)后跟两个符号(@)夹着任意数量的非符号字符.