regex.h...
- From: Alexander Sendzimir <sendzimir earthlink net>
- To: gtk-list redhat com
- Subject: regex.h...
- Date: Thu, 19 Aug 1999 16:50:15 -0400
I'm using regex.h to see what it can do. I can't get it to work properly
(for what I THINK it should work for).
Matching ^([[:digit:]]+)[[:space:]]+(.*)$ against the string "4096
four thousand ninety six" matches only the first group. In other words,
the matches returned are
"4096 four thousand ninety six"
"4096"
but no "four thousand ninety six". regcomp() sets re_nsub in the regex_t
structure to 2 as it should be. When I place an extra set of parentheses
around the last matching group it matches. That is,
^([[:digit:]]+)[[:space:]]+((.*)$) matches (notice ((.*)$) rather than
(.*)$) the above string as
"4096 four thousand ninety six"
"4096"
"four thousand ninety six"
Why can't I get by without the extra parens?
I have tried this with more complex regular expressions and the extra
set of parens still appear to be necessary.
Anyone have any ideas|experience with regex.h? Currently, I have no need
for machinery like GScanner.
Thanks.
abs
--
Alexander Sendzimir
Digitally Inclined
sendzimir@earthlink.net | 203 263 7405 | Woodbury, CT 06798-3017
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]