Re: regular expression help using regex.h in c program
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: regular expression help using regex.h in c program




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: regular expression help using regex.h in c program  
Hyuga


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-20-07 06:26 PM

On Jun 19, 7:23 am, bpatton <bpat...@ti.com> wrote:
> I'm writing in c
> using regex.h
> on a PC.
> using gcc
> using cygwin.
> Here is my string I'm looking for  :
>         COMMENT = "2A3:  ACTIVE perpendicular width where adjacent space i
s
> ACTIVE space >=  455 = 130"
>
> Here's where I'v compiled the regex.\ that works
>   if (regcomp(&rex_comm,"\\s*COMMENT\\s*",REG_EXTENDED|REG_NOSUB|
> REG_ICASE) != 0) {
> ...
>
> }
>
> target PERL style regular expression : ^\\s*COMMENT\\s*=\\s*\"
>
> fails with : ^\\s*COMMENT\\s*
> fails with : \\s*COMMENT\\s*\\=
> fails with : \\s*COMMENT\\s*[=]
>
> I've tried using Regex Coach, but it deals with PERL class regexp and
> it works fine.

This style of regular expression doesn't use perl-style escape
sequences like \s and \w.  Instead there are special character classes
such as [:space:] that you can use.  So for your example the following
would work: "[:space:]*COMMENT[:space:]*"
See http://www.opengroup.org/onlinepubs...799/xbd/re.html






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:27 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register