作者: Bruce.
日時: 2008/9/17(02:48)
Takeshi Oya さんは書きました (2008/09/17 1:55):

>  応用して、…。だ、駄目だ。'['はどうしたらよいのでしょう?

echo [TSfree:13] Re: 便利なメーラは?|mbsed -e "s/[^[]//g"
[

echo [TSfree:13] Re: 便利なメーラは?|mbsed -e "s/[^]\[]//g"
[]

echo [TSfree:13] Re: 便利なメーラは?|mbsed -e "s/[^][]//g"
mbsed: -e expression #1, char 10: unterminated `s' command



Basic Regular Expressions
http://www.opengroup.org/onlinepubs/007908799/xbd/re.html#tag_007_003_005

RE Bracket Expression


The right-bracket (]) loses its special meaning and represents itself in a
bracket expression if it occurs first in the list (after an initial circumflex
 (^), if any). Otherwise, it terminates the bracket expression, unless it appears
in a collating symbol (such as [.].]) or is the ending right-bracket for a
collating symbol, equivalence class or character class. The special characters:

.  *  [  \


(period, asterisk, left-bracket and backslash, respectively) lose their special
meaning within a bracket expression.



The hyphen character will be treated as itself if it occurs first (after an
initial ^, if any) or last in the list, or as an ending range point in a range
expression. As examples, the expressions [-ac] and [ac-] are equivalent and match
any of the characters a, c or -; [^-ac] and [^ac-] are equivalent and match any
characters except a, c or -;

-- 
木村浩一
  I thought what I'd do was, I'd pretend I was one of those deaf-mutes or should I?
  mail kbk [at] kt.rim.or.jp
        web  www.kt.rim.or.jp/~kbk/zakkicho/
             homepage3.nifty.com/farstar/