throwing away () matches

From: Brian Denheyer <briand_at_deldotd.com>
Date: Mon, 22 Feb 1999 12:42:52 -0800 (PST)

Maybe not a strictly STk related message, but I am want to try this
idea with stk.

I was noticing that I do a lot of () matching of things I don't want. e.g.,

"([a-z]+(\\[([0-9]+)\\])?"

to match

  id
  id[13]

However I am only interested in id and the number so I have to "throw
away" the optional grouping match which matches "[13]". I do this so
often, and I know other must, it seems to me that another
meta-character would be helpful. One that forces grouping but does not
"remember" the group. This seems like a trivial code change to any of
the regexp packages since it would be treated as a (), but would
simply "forget" the match and not return it to the calling routine.

My favorite candidate for such an extra character is {} or maybe <>.
It might break some code, but it would be easy enough to provide a
defien to turn it off. Of course it would also be turned-off by
default.

Does this sound like a good idea ? I was thinking about hacking the
stk regexp code, which is really Henry Spencer's regexp code and
trying it out. Is anybody else interested ?

Brian
--
Brian Denheyer             briand_at_deldotd.com
Deldot Design, Inc.        (503) 788-1607
__              
\/.d = Electronic design and development
Received on Mon Feb 22 1999 - 21:44:01 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST