LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   regexp question (https://www.linuxquestions.org/questions/linux-newbie-8/regexp-question-87893/)

rytrom 09-01-2003 04:38 AM

regexp question
 
I use bash2.05.

echo "ab]" | grep '^[a-z]*$

How to add ']' in a set of acceptable symbols? \] doesn't work

bigrigdriver 09-01-2003 10:59 AM

'man regexp' explains how to do it, in the section titled 'Regular Expressions' (last paragraph).

Dark_Helmet 09-01-2003 11:10 AM

I don't think grep handles regular expressions unless you give the -E or -G option. I could be wrong, but I don't know why they would include those options if grep handled regexps out-of-the-box.

rytrom 09-01-2003 12:50 PM

Shortly speaking, RTFM, as usual:
[To include a literal ] place it first in the list. Similarly, to include a literal ^ place it anywhere but first. Finally, to include a literal - place it last]


All times are GMT -5. The time now is 09:48 PM.