Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1967

Re: Regexp help

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.help
Subject Re: Regexp help
Date Wed, 08 Aug 2012 10:16:37 -0700
Organization A noiseless patient Spider
Lines 37
Message-ID <jvu6tp$gec$1@dont-email.me> (permalink)
References <3e0aa0ea-bdb5-4cd5-bdae-4fcd31c70a7f@googlegroups.com> <jVfUr.51896$ls7.32117@newsfe11.iad> <e8fd1c92-6f54-48ee-8cc9-ec5a10d03ce5@googlegroups.com> <HcwUr.685$CE7.526@newsfe12.iad>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 8 Aug 2012 17:16:41 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="16844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Hvc+vVjXTEg3ljMPvp1HWddto7zmlsg8="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
In-Reply-To <HcwUr.685$CE7.526@newsfe12.iad>
Cancel-Lock sha1:tGwOdNh+xgf3z0kowMBmDTj1JIs=
Xref csiph.com comp.lang.java.help:1967

Show key headers only | View raw


On 8/8/2012 9:11 AM, Daniel Pitts wrote:
> On 8/7/12 10:14 PM, mike wrote:
>> On Tuesday, August 7, 2012 11:38:21 PM UTC+2, Daniel Pitts wrote:
>>> On 8/7/12 7:03 AM, mike wrote:

>>>> How can I avoid get the parenthesis to be included in group(6) for
>>>> input 1?

>>> How about adding a \) after your group 6?

>>> or replacing your .* with [^)]*
>>
>> I tried it and it works for input #2 but not for input #1.

>> What I need is a regexp that works for both input.

> Well, you could also add a \)?\].  Or, you could have two regexs.  Or
> you could combine the regexs.


There's a quote that sometimes goes around the internet, something like 
this: "Sometimes a programmer who is confronted with a problem solves it 
with regex.  Now the programmer has two problems."

Regex is not the sharpest tool in the programmers toolbox.  It was 
intended to be used once, on a command line like with the grep tool, and 
then tossed away.

Take the time to write a parser to do what you want.  It'll probably be 
faster both ways:  you could write a parser faster than trying to figure 
out what regex you need to use, and regex is interpreted, whereas 
parsers can be optimized directly to machine code.  Win-win, and that's 
before taking into account the trouble maintenance programmers will have 
deciphering this regex.


Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Regexp help mike <mikaelpetterson@hotmail.com> - 2012-08-07 07:03 -0700
  Re: Regexp help Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-07 14:38 -0700
    Re: Regexp help mike <mikaelpetterson@hotmail.com> - 2012-08-07 22:14 -0700
      Re: Regexp help Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-08 09:11 -0700
        Re: Regexp help markspace <-@.> - 2012-08-08 10:16 -0700
          Re: Regexp help Gene Wirchenko <genew@ocis.net> - 2012-08-08 12:13 -0700
            Re: Regexp help markspace <-@.> - 2012-08-08 14:15 -0700
              Re: Regexp help Gene Wirchenko <genew@ocis.net> - 2012-08-08 18:43 -0700

csiph-web