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


Groups > comp.lang.c > #4207 > unrolled thread

how to use regex library

Started byOwner <Owner@Owner-PC.com>
First post2011-05-17 23:11 -0400
Last post2011-05-21 13:17 -0500
Articles 20 on this page of 65 — 15 participants

Back to article view | Back to comp.lang.c


Contents

  how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-17 23:11 -0400
    Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-18 03:33 +0000
      Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-18 06:41 -0400
        Re: how to use regex library James Kuyper <jameskuyper@verizon.net> - 2011-05-18 08:00 -0400
          Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-18 20:00 +0100
            Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-18 19:44 +0000
              Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 00:43 +0100
                Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 00:52 +0000
                  Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-18 22:04 -0400
                    Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 02:21 +0000
                      Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 04:04 +0100
                        Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 03:14 +0000
                          Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 12:03 +0100
                            Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 14:37 +0000
                              Re: how to use regex library Geoff <geoff@invalid.invalid> - 2011-05-19 11:29 -0700
                                Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 19:08 +0000
                                  Re: how to use regex library Geoff <geoff@invalid.invalid> - 2011-05-19 12:11 -0700
                                  Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-20 12:55 -0400
                  Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 04:01 +0100
              Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-19 16:02 +0000
                Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 16:34 +0000
                  Re: how to use regex library Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 13:59 -0700
                    Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 22:06 +0000
                      Re: how to use regex library Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 02:03 -0700
                    Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-20 13:14 -0400
                      Re: how to use regex library Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 02:16 -0700
              Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-19 14:37 -0400
            Re: how to use regex library James Kuyper <jameskuyper@verizon.net> - 2011-05-18 19:44 -0400
              Re: how to use regex library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 03:49 +0100
                Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 03:03 +0000
                  Re: how to use regex library Ike Naar <ike@iceland.freeshell.org> - 2011-05-19 06:48 +0000
                    Re: how to use regex library James Kuyper <jameskuyper@verizon.net> - 2011-05-19 05:58 -0400
                    Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 14:37 +0000
              Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-19 14:48 -0400
                Re: how to use regex library Shao Miller <sha0.miller@gmail.com> - 2011-05-19 15:05 -0400
        Re: how to use regex library Mark Bluemel <mark_bluemel@pobox.com> - 2011-05-18 13:36 +0100
          Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-18 13:13 -0400
          Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-18 22:13 -0400
            Re: how to use regex library Mark Bluemel <mark_bluemel@pobox.com> - 2011-05-19 08:55 +0100
              Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-19 07:59 -0400
                Re: how to use regex library Keith Thompson <kst-u@mib.org> - 2011-05-19 08:50 -0700
                Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-19 15:12 -0400
                  Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 19:40 +0000
                    Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-19 20:58 +0000
                      Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-19 22:06 +0000
                        Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-20 01:01 +0000
                          Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-20 01:57 +0000
                        Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-20 13:27 -0400
                      Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-20 13:08 -0400
                        Re: how to use regex library Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-20 18:54 +0100
                          Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-20 19:14 +0000
                            Re: how to use regex library Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-21 00:04 +0100
                          Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-23 12:42 -0400
                            Re: how to use regex library Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-23 20:16 +0100
                        Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-23 21:16 +0000
                          Re: how to use regex library Kenneth Brody <kenbrody@spamcop.net> - 2011-05-24 12:08 -0400
                            Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-25 05:27 +0000
                      Re: how to use regex library Michael Press <rubrum@pacbell.net> - 2011-05-22 21:41 -0700
                        Re: how to use regex library cri@tiac.net (Richard Harter) - 2011-05-23 21:33 +0000
        Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-18 16:03 +0000
      Re: how to use regex library Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-05-18 14:05 +0000
    Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-20 22:06 -0400
      Re: how to use regex library Seebs <usenet-nospam@seebs.net> - 2011-05-21 03:49 +0000
        Re: how to use regex library Owner <Owner@Owner-PC.com> - 2011-05-21 20:25 -0400
      Re: how to use regex library Shao Miller <sha0.miller@gmail.com> - 2011-05-21 13:17 -0500

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#4339

FromSeebs <usenet-nospam@seebs.net>
Date2011-05-19 16:34 +0000
Message-ID<slrnitagel.iav.usenet-nospam@guild.seebs.net>
In reply to#4335
On 2011-05-19, Richard Harter <cri@tiac.net> wrote:
> In short, these are the kinds of questions you are prepared to answer.
> However this is of no help to the OP, who is obviously muddling around
> at the very beginning of understanding how to the said package.

The missing verb pretty much highlights the problem I'm having; I can
speculate that you probably meant "how to use", but I don't have any way
of telling whether that's reasonable.

> Of course there is.  Below I quote Mark Bluemel's response.  It is an
> excellent example of how to answer such a query.  He was helpful.  You
> are not.

Right.  It's one of the known limitations of the way I respond to questions;
I can only answer the question actually asked, I can't mind-read.  To this
day, I still don't know whether the OP actually specifically needed to use
regexes, or was just trying to experiment with using libraries in the general
case.  I can't tell whether he selected Spencer's regex library randomly from
the pool of all libraries, or as a regex library (a much narrower field).  I
can't tell whether he wants regular expressions or whether all he really
needs is someone to point out that strstr() is in the standard library.  I
have no clue what he wants to *do*.

If the OP had said, say:
	I want to match strings against a regex, but I don't know how to use
	this API to accomplish that.  The description of the arguments
	used by regexec() doesn't make any sense to me.
that would be something I could respond to easily, because it would give me
some idea of what the question was.

That said, I'm not at all sure I accept the claim that my response isn't also
helpful.  The OP would get much better answers much sooner if he would learn
to ask specific questions and explain what he's trying to do.  Pointing out
to him that not everyone is telepathic might be one way to help him develop
this valuable skill.

In the long run, no question anyone has ever answered for me has helped me as
much as being told how to ask better questions.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#4370

FromTim Rentsch <txr@alumni.caltech.edu>
Date2011-05-19 13:59 -0700
Message-ID<kfnsjsatnje.fsf@x-alumni2.alumni.caltech.edu>
In reply to#4339
Seebs <usenet-nospam@seebs.net> writes:

> On 2011-05-19, Richard Harter <cri@tiac.net> wrote:
>> In short, these are the kinds of questions you are prepared to answer.
>> However this is of no help to the OP, who is obviously muddling around
>> at the very beginning of understanding how to the said package.
>
> The missing verb pretty much highlights the problem I'm having; I can
> speculate that you probably meant "how to use", but I don't have any way
> of telling whether that's reasonable.
>
>> Of course there is.  Below I quote Mark Bluemel's response.  It is an
>> excellent example of how to answer such a query.  He was helpful.  You
>> are not.
>
> Right.  It's one of the known limitations of the way I respond to questions;
> I can only answer the question actually asked, I can't mind-read.
> [snip elaboration]

Since it's your limitation, and since you know about it,
maybe it's better for you not to respond in such cases,
and let other people answer who are more able to help.
Yes?  I understand your frustration at not being able
to provide a helpful answer, but the OP isn't responsible
for that frustation, even if his posting is part of what
caused it.

[toc] | [prev] | [next] | [standalone]


#4387

FromSeebs <usenet-nospam@seebs.net>
Date2011-05-19 22:06 +0000
Message-ID<slrnitb48g.uvp.usenet-nospam@guild.seebs.net>
In reply to#4370
On 2011-05-19, Tim Rentsch <txr@alumni.caltech.edu> wrote:
> Since it's your limitation, and since you know about it,
> maybe it's better for you not to respond in such cases,
> and let other people answer who are more able to help.
> Yes?

Maybe.  The thing is, in a fair number of cases, other people can't
tell; this is why ESR's "smart questions" page exists.  Perhaps more
importantly, in some cases, other people can't tell that they can't
tell, and no one gets anywhere until someone points out that the question
was vague.

> I understand your frustration at not being able
> to provide a helpful answer, but the OP isn't responsible
> for that frustation, even if his posting is part of what
> caused it.

Having read a number of his posts, I would tend to consider him responsible
for his failure to clearly state what he's trying to do, because he clearly
has good enough English to read ESR's page and follow the guidelines there.
His questions strike me as not showing much of an effort to figure things
out before he posts, and I like to remind people that even a small amount
of effort can save a LOT of time.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#4682

FromTim Rentsch <txr@alumni.caltech.edu>
Date2011-05-24 02:03 -0700
Message-ID<kfnei3osc5r.fsf@x-alumni2.alumni.caltech.edu>
In reply to#4387
Seebs <usenet-nospam@seebs.net> writes:

> On 2011-05-19, Tim Rentsch <txr@alumni.caltech.edu> wrote:
>> Since it's your limitation, and since you know about it,
>> maybe it's better for you not to respond in such cases,
>> and let other people answer who are more able to help.
>> Yes?
>
> Maybe.  The thing is, in a fair number of cases, other people can't
> tell; this is why ESR's "smart questions" page exists.  Perhaps more
> importantly, in some cases, other people can't tell that they can't
> tell, and no one gets anywhere until someone points out that the question
> was vague.

In that case I suggest you wait a few days before responding.
It's likely that someone else will be able to help, and if
not the lack of response may prompt further thought on the
part of the OP.  In either of those cases, you are spared
the effort of responding, and the S/N ratio of the newsgroup
goes up.

>> I understand your frustration at not being able
>> to provide a helpful answer, but the OP isn't responsible
>> for that frustation, even if his posting is part of what
>> caused it.
>
> Having read a number of his posts, I would tend to consider him responsible
> for his failure to clearly state what he's trying to do, because he clearly
> has good enough English to read ESR's page and follow the guidelines there.
> His questions strike me as not showing much of an effort to figure things
> out before he posts, and I like to remind people that even a small amount
> of effort can save a LOT of time.

Part of what I'm suggesting is that the reminders being sent,
even though you may like to send them, don't have a high
effectiveness hit ratio, and if they don't it's probably a
good idea to try a different strategy.

[toc] | [prev] | [next] | [standalone]


#4440

FromKenneth Brody <kenbrody@spamcop.net>
Date2011-05-20 13:14 -0400
Message-ID<1P6dnellCo_iPEvQnZ2dnUVZ_jadnZ2d@bestweb.net>
In reply to#4370
On 5/19/2011 4:59 PM, Tim Rentsch wrote:
> Seebs<usenet-nospam@seebs.net>  writes:
>> On 2011-05-19, Richard Harter<cri@tiac.net>  wrote:
[...]
>>> Of course there is.  Below I quote Mark Bluemel's response.  It is an
>>> excellent example of how to answer such a query.  He was helpful.  You
>>> are not.
>>
>> Right.  It's one of the known limitations of the way I respond to questions;
>> I can only answer the question actually asked, I can't mind-read.
>> [snip elaboration]
>
> Since it's your limitation, and since you know about it,
> maybe it's better for you not to respond in such cases,
> and let other people answer who are more able to help.
> Yes?  I understand your frustration at not being able
> to provide a helpful answer, but the OP isn't responsible
> for that frustation, even if his posting is part of what
> caused it.

"I can't print.  Fix it."

Yes, that was a real report we got once.  No other details, even after 
repeated requests for such.

How would you suggest fixing it?  (Note that you are being paid to support 
said user.  This is not a case of "I read Usenet for recreational purposes". 
  Therefore, "sorry, go away" is not an acceptable answer.)

Sbe gur erpbeq, gur ceboyrz jnf n oebxra cva ba gur zbhfr, fb gur hfre 
jnfa'g noyr gb pyvpx gur "cevag" ohggba.  Fur jnf, ubjrire, noyr gb fgneg 
gur pbzchgre, ybt va, fgneg gur jbeq cebprffbe, naq ybnq gur qbphzrag, nyy 
jvgubhg abgvpvat gung gur zbhfr jnfa'g jbexvat.

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#4683

FromTim Rentsch <txr@alumni.caltech.edu>
Date2011-05-24 02:16 -0700
Message-ID<kfnaaecsbkw.fsf@x-alumni2.alumni.caltech.edu>
In reply to#4440
Kenneth Brody <kenbrody@spamcop.net> writes:

> On 5/19/2011 4:59 PM, Tim Rentsch wrote:
>> Seebs<usenet-nospam@seebs.net>  writes:
>>> On 2011-05-19, Richard Harter<cri@tiac.net>  wrote:
> [...]
>>>> Of course there is.  Below I quote Mark Bluemel's response.  It is an
>>>> excellent example of how to answer such a query.  He was helpful.  You
>>>> are not.
>>>
>>> Right.  It's one of the known limitations of the way I respond to questions;
>>> I can only answer the question actually asked, I can't mind-read.
>>> [snip elaboration]
>>
>> Since it's your limitation, and since you know about it,
>> maybe it's better for you not to respond in such cases,
>> and let other people answer who are more able to help.
>> Yes?  I understand your frustration at not being able
>> to provide a helpful answer, but the OP isn't responsible
>> for that frustation, even if his posting is part of what
>> caused it.
>
> "I can't print.  Fix it."
>
> Yes, that was a real report we got once.  No other details, even after
> repeated requests for such.
>
> How would you suggest fixing it?  (Note that you are being paid to
> support said user.  This is not a case of "I read Usenet for
> recreational purposes". Therefore, "sorry, go away" is not an
> acceptable answer.)

I honestly don't know.  If it were my job and for whatever
reason no one else could (or would) do it, I imagine I'd try
something, and something else, etc, hoping to get something
figured out.  My point though is about the situation where
there is another person available and there is reason to
believe that one or more of these other folks are likely to
be more effective than I am in my bumbling non-eptitude --
in that case, I would hope one of the more competent folks
would work on that, and I would look for something to work
on which I would be more likely to be do effectively.

[toc] | [prev] | [next] | [standalone]


#4349

FromKenneth Brody <kenbrody@spamcop.net>
Date2011-05-19 14:37 -0400
Message-ID<gMqdnTfs0YnB_kjQnZ2dnUVZ_u6dnZ2d@bestweb.net>
In reply to#4243
On 5/18/2011 3:44 PM, Seebs wrote:
> On 2011-05-18, Ben Bacarisse<ben.usenet@bsb.me.uk>  wrote:
[...]
>> I agree that the OP has not answered the question the Seebs asked, but I
>> don't see why he or she must answer it.  What's wrong with asking (in a
>> round about way) "can you help me use the XYZ library?".
>
> The lack of any indication of what the problem is.  Consider the following
> questions I might have about a regex library:
>
> * How do I link this with my program?
[...]
> * What's the difference between regcomp() and regexec()?

*  My compiler doesn't include a <regex.h> file.  Where can I get it?

*  The only documentation on my system for "regcomp" is for some "registry 
compression" utility.  Now what?

(And, to answer your question elsethread, Microsoft's Visual Studio does 
include a "Regex" class under .NET Framework, but does not include 
regcomp/regexec/regfree functions for C.)

[...]

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#4261

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-05-18 19:44 -0400
Message-ID<ir1lkr$joh$1@dont-email.me>
In reply to#4238
On 05/18/2011 03:00 PM, Ben Bacarisse wrote:
> James Kuyper <jameskuyper@verizon.net> writes:
> <snip>
>> Please explain what you want to do. If your answer contains, anywhere
>> within it, the words "regex", "library", "henry", "spencer", "RE", or
>> "try.c", then you're still answering the wrong question - please rewrite it.
> 
> I agree that the OP has not answered the question the Seebs asked, but I
> don't see why he or she must answer it.  What's wrong with asking (in a
> round about way) "can you help me use the XYZ library?".

There are two things wrong with that question:
1. It's too vague. Seebs has already expounded at length on this issue,
so I don't need to add anything more.
2. The XYZ library might be the wrong solution to the OP's question.

-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#4277

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2011-05-19 03:49 +0100
Message-ID<0.3c260ac3c44724d5cc64.20110519034905BST.87oc2zs8v2.fsf@bsb.me.uk>
In reply to#4261
James Kuyper <jameskuyper@verizon.net> writes:

> On 05/18/2011 03:00 PM, Ben Bacarisse wrote:
>> James Kuyper <jameskuyper@verizon.net> writes:
>> <snip>
>>> Please explain what you want to do. If your answer contains, anywhere
>>> within it, the words "regex", "library", "henry", "spencer", "RE", or
>>> "try.c", then you're still answering the wrong question - please rewrite it.
>> 
>> I agree that the OP has not answered the question the Seebs asked, but I
>> don't see why he or she must answer it.  What's wrong with asking (in a
>> round about way) "can you help me use the XYZ library?".
>
> There are two things wrong with that question:
> 1. It's too vague. Seebs has already expounded at length on this issue,
> so I don't need to add anything more.
> 2. The XYZ library might be the wrong solution to the OP's question.

I'm sorry you don't want to expand on 1 because I think it's key.  Some
people have vague questions because they don't know enough to be more
specific.  I got a clear sense of what the OP wanted and the fact that
they seem to be happy with the reply from... sorry can't find it right
now, backs this up.  With some very vague questions, almost any help is
gratefully received because it blows away some of the fog.  I don't have
the same problem with them that some people seem to have.

I find 2 very odd.  The library may be wrong but learning about it might
be good.  Some people go so far as to claim that all knowledge is of
some benefit.  I get that you may not want to answer unless the
questioner has demonstrated that the information won't lead to the wrong
solution, but that approach is far too authoritarian for my liking.

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#4281

FromSeebs <usenet-nospam@seebs.net>
Date2011-05-19 03:03 +0000
Message-ID<slrnit9235.2ja0.usenet-nospam@guild.seebs.net>
In reply to#4277
On 2011-05-19, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote:
> I'm sorry you don't want to expand on 1 because I think it's key.  Some
> people have vague questions because they don't know enough to be more
> specific.  I got a clear sense of what the OP wanted and the fact that
> they seem to be happy with the reply from... sorry can't find it right
> now, backs this up.

Really?

I'd say the post saying that the library was selected randomly sort of
indicates that the question is... well, I still can't tell what it is.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#4297

FromIke Naar <ike@iceland.freeshell.org>
Date2011-05-19 06:48 +0000
Message-ID<slrn3vfsit9fa2.had.ike@iceland.freeshell.org>
In reply to#4281
On 2011-05-19, Seebs <usenet-nospam@seebs.net> wrote:
> I'd say the post saying that the library was selected randomly sort of
> indicates that the question is... well, I still can't tell what it is.

It occurs to me that the OP meant to say that the library was
selected randomly from a set of libraries that offer regex support,
not from the set of all libraries written in C.

[toc] | [prev] | [next] | [standalone]


#4309

FromJames Kuyper <jameskuyper@verizon.net>
Date2011-05-19 05:58 -0400
Message-ID<ir2pkv$7rj$1@dont-email.me>
In reply to#4297
On 05/19/2011 02:48 AM, Ike Naar wrote:
> On 2011-05-19, Seebs <usenet-nospam@seebs.net> wrote:
>> I'd say the post saying that the library was selected randomly sort of
>> indicates that the question is... well, I still can't tell what it is.
> 
> It occurs to me that the OP meant to say that the library was
> selected randomly from a set of libraries that offer regex support,
> not from the set of all libraries written in C.

Given that this was his approach, the right answer to the
correctly-posed question might be "don't use this library, use this
alternative library...". However, the question was not correctly posed.
It takes more information, of a different type, than has been provided
to decide whether this is the right answer, and which alternative he
should be redirected to if it is.

-- 
James Kuyper

[toc] | [prev] | [next] | [standalone]


#4324

FromSeebs <usenet-nospam@seebs.net>
Date2011-05-19 14:37 +0000
Message-ID<slrnita9ub.ei7.usenet-nospam@guild.seebs.net>
In reply to#4297
On 2011-05-19, Ike Naar <ike@iceland.freeshell.org> wrote:
> On 2011-05-19, Seebs <usenet-nospam@seebs.net> wrote:
>> I'd say the post saying that the library was selected randomly sort of
>> indicates that the question is... well, I still can't tell what it is.

> It occurs to me that the OP meant to say that the library was
> selected randomly from a set of libraries that offer regex support,
> not from the set of all libraries written in C.

Could be.  The statement made, though, was merely that the library was
not chosen for any specific reason.

I can't tell how much of this is vague thinking, and how much of it is
just vague writing.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.

[toc] | [prev] | [next] | [standalone]


#4352

FromKenneth Brody <kenbrody@spamcop.net>
Date2011-05-19 14:48 -0400
Message-ID<TYudnSxIa_h_-EjQnZ2dnUVZ_vKdnZ2d@bestweb.net>
In reply to#4261
On 5/18/2011 7:44 PM, James Kuyper wrote:
> On 05/18/2011 03:00 PM, Ben Bacarisse wrote:
>> James Kuyper<jameskuyper@verizon.net>  writes:
>> <snip>
>>> Please explain what you want to do. If your answer contains, anywhere
>>> within it, the words "regex", "library", "henry", "spencer", "RE", or
>>> "try.c", then you're still answering the wrong question - please rewrite it.
>>
>> I agree that the OP has not answered the question the Seebs asked, but I
>> don't see why he or she must answer it.  What's wrong with asking (in a
>> round about way) "can you help me use the XYZ library?".
>
> There are two things wrong with that question:
> 1. It's too vague. Seebs has already expounded at length on this issue,
> so I don't need to add anything more.
> 2. The XYZ library might be the wrong solution to the OP's question.

Reminds me of a recent e-mail exchange between my wife and someone who 
posted a "wanted" notice for a "replacement hard drive".  She explained that 
she needed more information -- IDE or SATA, what capacity, etc.  It went 
back and forth several times, without any useful information from him, even 
after "here's how you tell IDE from SATA"-like details.  (We had several old 
drives of both types laying around, and were willing to give one to him.) 
It soon became obvious that he had no business opening up a computer and 
replacing a hard drive, due to his total lack of knowledge and ability to 
get a clue, not to mention his increasing attitude of "why are you making 
this so difficult" answers.

Finally, we were able to determine that he was asking the wrong question 
from the get-go, when he said something about just wanting to connect his 
"Dell monitor" to a "new hard drive".  I assume that everyone here can fill 
in the rest.

-- 
Kenneth Brody

[toc] | [prev] | [next] | [standalone]


#4354

FromShao Miller <sha0.miller@gmail.com>
Date2011-05-19 15:05 -0400
Message-ID<ir3pl5$kas$1@dont-email.me>
In reply to#4352
On 5/19/2011 14:48, Kenneth Brody wrote:
> Reminds me of a recent e-mail exchange between my wife and someone who
> posted a "wanted" notice for a "replacement hard drive". She explained
> that she needed more information -- IDE or SATA, what capacity, etc. It
> went back and forth several times, without any useful information from
> him, even after "here's how you tell IDE from SATA"-like details. (We
> had several old drives of both types laying around, and were willing to
> give one to him.) It soon became obvious that he had no business opening
> up a computer and replacing a hard drive, due to his total lack of
> knowledge and ability to get a clue, not to mention his increasing
> attitude of "why are you making this so difficult" answers.
>
> Finally, we were able to determine that he was asking the wrong question
> from the get-go, when he said something about just wanting to connect
> his "Dell monitor" to a "new hard drive". I assume that everyone here
> can fill in the rest.
>

This sounds like every "Quick question for you..." phone call I get. 
Very familiar. :)

[toc] | [prev] | [next] | [standalone]


#4223

FromMark Bluemel <mark_bluemel@pobox.com>
Date2011-05-18 13:36 +0100
Message-ID<ir0eii$6t7$1@dont-email.me>
In reply to#4218
On 05/18/2011 11:41 AM, Owner wrote:

> I apologize for vagueness.  I'm asking to anyone knows how to use
> henry spencer's regex library.

I didn't, but having looked at it briefly, I think I could do so now.

Have you tried reading the manual page? The principles seem fairly 
straightforward - the crucial thing you need to understand is that your 
expectation is wrong.

 > I expected to send RE pattern
 > and target string to the library, then it send me back with either
 > match was found of not, if found send me back position in the
 > target string and length of matched string.

Why did you expect this? You should try and understand the API as 
implemented and documented rather than what you hope it might be.

Key points (illustrated from the example program):-

1) the regular expression needs to be compiled before use

	#include <regexp.h>
	regexp *r;
	r = regcomp(argv[1]);	/* compile RE from command line*/

2) there may be multiple parenthesized expressions to be matched, so you 
can't expect to only have a single position and length.
(There can be up to NSUBEXP that the library will handle, NSUBEXP 
defaults to 10, but can be changed by recompilation)

	int i;
	/* did the string from the command line match ? */
	i = regexec(r, argv[2]);
	printf("%d", i);
	for (i = 1; i < NSUBEXP; i++)
	/* check start and end pointers for matched expressions */
		if (r->startp[i] != NULL && r->endp[i] != NULL)
			printf(" \\%d", i);

[toc] | [prev] | [next] | [standalone]


#4231

FromOwner <Owner@Owner-PC.com>
Date2011-05-18 13:13 -0400
Message-ID<pan.2011.05.18.17.13.03.685000@Owner-PC.com>
In reply to#4223
This might help a lot.  

Thank you!

[toc] | [prev] | [next] | [standalone]


#4272

FromOwner <Owner@Owner-PC.com>
Date2011-05-18 22:13 -0400
Message-ID<pan.2011.05.19.02.13.27.514000@Owner-PC.com>
In reply to#4223
On Wed, 18 May 2011 13:36:17 +0100, Mark Bluemel wrote:

> On 05/18/2011 11:41 AM, Owner wrote:
> 
>> I apologize for vagueness.  I'm asking to anyone knows how to use
>> henry spencer's regex library.
> 
> I didn't, but having looked at it briefly, I think I could do so now.
> 
> Have you tried reading the manual page? The principles seem fairly 
> straightforward - the crucial thing you need to understand is that your 
> expectation is wrong.
> 
>  > I expected to send RE pattern
>  > and target string to the library, then it send me back with either
>  > match was found of not, if found send me back position in the
>  > target string and length of matched string.
> 
> Why did you expect this? You should try and understand the API as 
> implemented and documented rather than what you hope it might be.
> 
> Key points (illustrated from the example program):-
> 
> 1) the regular expression needs to be compiled before use
> 
> 	#include <regexp.h>
> 	regexp *r;
> 	r = regcomp(argv[1]);	/* compile RE from command line*/
> 
> 2) there may be multiple parenthesized expressions to be matched, so you 
> can't expect to only have a single position and length.
> (There can be up to NSUBEXP that the library will handle, NSUBEXP 
> defaults to 10, but can be changed by recompilation)
> 
> 	int i;
> 	/* did the string from the command line match ? */
> 	i = regexec(r, argv[2]);
> 	printf("%d", i);
> 	for (i = 1; i < NSUBEXP; i++)
> 	/* check start and end pointers for matched expressions */
> 		if (r->startp[i] != NULL && r->endp[i] != NULL)
> 			printf(" \\%d", i);

I ended up back to the beginning.  I read man after converting

the regexp.3 file to ps using groff and again converted it to 

pdf format file.  r.startp is pointer to start of matched string 

and endp is a pointer to the one after matched string.  

what does regsub do?  it says it's for substitution.

can I build sed program with regsub?

void
regsub(rp, source, dest)
const regexp *rp;
const char *source;
char *dest;
{

[toc] | [prev] | [next] | [standalone]


#4302

FromMark Bluemel <mark_bluemel@pobox.com>
Date2011-05-19 08:55 +0100
Message-ID<ir2ifv$111$1@dont-email.me>
In reply to#4272
On 05/19/2011 03:13 AM, Owner wrote:

> what does regsub do?  it says it's for substitution.

The manual explains what it does, the test program (try.c) and the 
driver for the test program (the "tests" file) show how to use it. If 
you understand regular expressions, it should be fairly straightforward 
to understand.

Try spending more time looking at the information you have rather than 
asking other people to do your thinking for you.

[toc] | [prev] | [next] | [standalone]


#4318

FromOwner <Owner@Owner-PC.com>
Date2011-05-19 07:59 -0400
Message-ID<pan.2011.05.19.11.59.30.927000@Owner-PC.com>
In reply to#4302
> 
> Try spending more time looking at the information you have rather than 
> asking other people to do your thinking for you.

Sorry to bother you again.  

Now I get it some of it.  My mind was stick to the getting a matched

position and length, I didn't see that getting those information is

irrelevant.  And the library provides mainly whether there is 

a match, and routine for replacing matched string.  

I knew what regexp was(that's why I wanted use the library).

I just didn't understand the process (sequence) of using

regexp library.  I was able to compile try.c and own simple

test routine.

I did get print out of matched string with following code.

while (r->startp[0] < r->endp[0])
		putchar(*r->startp[0]++);
	putchar('\n');

and Now I understand better, I copied following routine

regsub(r, argv[3] , result);
	
	printf("%s\n", result);

to my test routine.

getting output what I expected.

c:\Users\(no showing)\Desktop\regexp.old_project>retest " hi.*" "this is
hi to the worl rd" "& well &"
1 hi to the worlrd well  hi to the worlrd

1 is just indicating a match was found.

I thank all for your help.  Now I can sleep well 

Thank you again

[toc] | [prev] | [next] | [standalone]


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

Back to top | Article view | comp.lang.c


csiph-web