LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] regular expression question

[ILUG] regular expression question

Mark McLoughlin mark at skynet.ie
Wed Nov 14 12:44:46 GMT 2001


Hi Padraig,

On Tue, 13 Nov 2001, Padraig Brady wrote:

> Cheers, Dave that's it.
> I really wish there was only 1 regexp syntax to learn.
>
>  From the man page:
>
> "In basic regular expressions the metacharacters ?, +, {, |, (, and )
> lose their special meaning; instead use the backslashed versions \?, \+,
> \{, \|, \(, and \)."
>
> So I need to do \+ not just + so....
>
> [padraig at pixelbeat findul]$ grep "^/\(usr/lib\|lib\)/[^/]\+$" input.txt
> /lib/libthread_db-1.0.so
> /usr/lib/lib_alchemistmodule.so

	This best place to check this out is in /usr/include/regex.h:

/* If this bit is not set, then + and ? are operators, and \+ and \?
 * are literals.
   If set, then \+ and \? are operators and + and ? are literals.  */
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)

	and

#define RE_SYNTAX_GREP \
  (RE_BK_PLUS_QM              | RE_CHAR_CLASSES \
   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
   | RE_NEWLINE_ALT)

	but of course, its kinda obtuse, so I got confused looking
at it yesterday :-)

Good Luck,
Mark.





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell