Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-01-2003, 05:38 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 27

Rep: Reputation: 15
regexp question

I use bash2.05.

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

How to add ']' in a set of acceptable symbols? \] doesn't work
Old 09-01-2003, 11:59 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
'man regexp' explains how to do it, in the section titled 'Regular Expressions' (last paragraph).
Old 09-01-2003, 12:10 PM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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.
Old 09-01-2003, 01:50 PM   #4
LQ Newbie
Registered: Jul 2003
Posts: 27

Original Poster
Rep: Reputation: 15
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]


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
regexp help cliff76 Linux - Newbie 3 03-07-2008 03:15 PM
little help for regexp EmOuBi Linux - Newbie 6 08-06-2005 03:19 AM
Regexp question scuffell Programming 4 04-30-2005 04:35 AM
regexp help ... pld Programming 1 03-15-2005 04:45 PM
postfix regexp question wijnands Linux - Newbie 1 06-03-2004 07:19 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:15 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration