For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2007 > regular expression help using regex.h in c program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author regular expression help using regex.h in c program
bpatton

2007-06-19, 8:05 am

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 is
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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com