[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to match regex in bash? (any character)
From: |
Greg Wooledge |
Subject: |
Re: How to match regex in bash? (any character) |
Date: |
Thu, 29 Sep 2011 13:46:05 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Sep 29, 2011 at 11:18:57AM -0500, Peng Yu wrote:
> Also, regex(3) does not mention the difference between $x =~ xxxx.txt
> and $x=~ "xxxx.txt". I think that the difference should be addressed
> in man bash.
It already is.
An additional binary operator, =~, is available, with the same
precedence as == and !=. When it is used, the string to the
right of the operator is considered an extended regular
expression and matched accordingly (as in regex(3)). The return
value is 0 if the string matches the pattern, and 1 otherwise.
If the regular expression is syntactically incorrect, the
conditional expression's return value is 2. If the shell option
nocasematch is enabled, the match is performed without regard to
the case of alphabetic characters. Any part of the pattern may
be quoted to force it to be matched as a string.
The last sentence in the quote above.
> Bottom line, regex(3) is not a good manpage to refer in the above
> sentence.
Maybe it's not a good one, but it is the only *possible* one.
- Re: How to match regex in bash? (any character), (continued)
- Re: How to match regex in bash? (any character), Peng Yu, 2011/09/29
- Re: How to match regex in bash? (any character), Chet Ramey, 2011/09/29
- Re: How to match regex in bash? (any character), Peng Yu, 2011/09/29
- Re: How to match regex in bash? (any character), Chet Ramey, 2011/09/29
- Re: How to match regex in bash? (any character), Roger, 2011/09/29
- Re: How to match regex in bash? (any character), Stephane CHAZELAS, 2011/09/30
- Re: How to match regex in bash? (any character), Roger, 2011/09/30
- Re: How to match regex in bash? (any character), Greg Wooledge, 2011/09/29
- Re: How to match regex in bash? (any character), Peng Yu, 2011/09/29
- Re: How to match regex in bash? (any character), Roman Rakus, 2011/09/29
- Re: How to match regex in bash? (any character),
Greg Wooledge <=
- Re: How to match regex in bash? (any character), Chet Ramey, 2011/09/29
- Re: How to match regex in bash? (any character), Chet Ramey, 2011/09/29