Code Comments
Programming Forum and web based access to our favorite programming groups.Or do we need to have any specific library ? I am more interested in knowing if we can do string pattern matching regular expression processing with C. Thanks Mahendra
Post Follow-up to this messageMahendra Kutare wrote: > Or do we need to have any specific library ? > > I am more interested in knowing if we can do string pattern matching > regular expression processing with C. > Not in standard C, there are plenty of extensions (POSIX regex for example). -- Ian Collins.
Post Follow-up to this messageIn article <65g9ppF2g815vU4@mid.individual.net>, Ian Collins <ian-news@hotmail.com> wrote: > Mahendra Kutare wrote: > Not in standard C, there are plenty of extensions (POSIX regex for example).[/colo r] And I betcha that was written in ... wait for it ... C! Yes, you can indeed do regular expression processing in C. Even in absolutely 100% standard C. You can do *DAMN NEAR ANYTHING* in standard C. (Even *THAT*? Get your mind out of the gutter! I said "damn near"! :) ) You just have to be willing (and able) to write the code to do it if you don't have (or for some reason don't want to/aren't allowed to use) a library routine that already does it for you. Fortunately, at this stage in the game there are many excellent libraries available out there that do many useful things, and they are perfectly compatible with standard C (and quite possibly written in standard C) even if they aren't specced by the C standard as being officially part of the language. Not being required by the standard doesn't make them any less "standard C". -- Don Bruder - dakidd@sonic.net - If your "From:" address isn't on my whitelis t, or the subject of the message doesn't contain the exact text "PopperAndShado w" somewhere, any message sent to this address will go in the garbage without m y ever knowing it arrived. Sorry... <http://www.sonic.net/~dakidd> for more in fo
Post Follow-up to this messageDon Bruder wrote: > In article <65g9ppF2g815vU4@mid.individual.net>, > Ian Collins <ian-news@hotmail.com> wrote: > > > Not being required by the standard doesn't make them any less "standard C" . > OK, to disambiguate my reply further, regular expressions are not part of the standard library. -- Ian Collins.
Post Follow-up to this message"Mahendra Kutare" <imax@cc.gatech.edu> wrote in message news:fsuqqg$7lv$1@news-int.gatech.edu... > Or do we need to have any specific library ? > > I am more interested in knowing if we can do string pattern matching > regular expression processing with C. It's a FAQ: 13.7: I need some code to do regular expression and wildcard matching. A: Make sure you recognize the difference between classic regular expressions (variants of which are used in such Unix utilities as ed and grep), and filename wildcards (variants of which are used by most operating systems). There are a number of packages available for matching regular expressions. Most packages use a pair of functions, one for "compiling" the regular expression, and one for "executing" it (i.e. matching strings against it). Look for header files named <regex.h> or <regexp.h>, and functions called regcmp/regex, regcomp/regexec, or re_comp/re_exec. (These functions may exist in a separate regexp library.) A popular, freely- redistributable regexp package by Henry Spencer is available from ftp.cs.toronto.edu in pub/regexp.shar.Z or in several other archives. The GNU project has a package called rx. See also question 18.16. Filename wildcard matching (sometimes called "globbing") is done in a variety of ways on different systems. On Unix, wildcards are automatically expanded by the shell before a process is invoked, so programs rarely have to worry about them explicitly. Under MS-DOS compilers, there is often a special object file which can be linked in to a program to expand wildcards while argv is being built. Several systems (including MS-DOS and VMS) provide system services for listing or opening files specified by wildcards. Check your compiler/library documentation. See also questions 19.20 and 20.3. -- Posted via a free Usenet account from http://www.teranews.com
Post Follow-up to this messageOn Wed, 02 Apr 2008 15:36:41 +1300, Ian Collins <ian-news@hotmail.com> wrote in comp.lang.c: > Mahendra Kutare wrote: > Not in standard C, there are plenty of extensions (POSIX regex for example).[/colo r] I disagree, one most certainly can. There are no functions for doing this in the standard library, so one would have to either write them, or find a library that already contained them. But such a library could be written in strictly conforming C, at least for the ASCII character set. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Post Follow-up to this messageJack Klein wrote: > On Wed, 02 Apr 2008 15:36:41 +1300, Ian Collins <ian-news@hotmail.com> > wrote in comp.lang.c: > > > I disagree, one most certainly can. > > There are no functions for doing this in the standard library, so one > would have to either write them, or find a library that already > contained them. But such a library could be written in strictly > conforming C, at least for the ASCII character set. > Didn't you see the clarification I posted an hour earlier? -- Ian Collins.
Post Follow-up to this messageIn article <65gg17F2g815vU6@mid.individual.net>, Ian Collins <ian-news@hotmail.com> wrote: > Jack Klein wrote: > Didn't you see the clarification I posted an hour earlier? Quite possibly not, since Usenet is a best-effort, asynchronous distribution system that makes absolutely no promises whatsoever that any specific message will reach any given server in any particular amount of time. Depending on the route it has to take, the newsgroup(s) it's posted to, the time of day it was posted, and many other variables including how the destination server (and any servers between the one you posted on and the destination) is configured, a message you post to your news server might be seen on a different server within seconds. Or it could take anywhere from minutes to ws to get there. Assuming it ever makes the trip at all... -- Don Bruder - dakidd@sonic.net - If your "From:" address isn't on my whitelis t, or the subject of the message doesn't contain the exact text "PopperAndShado w" somewhere, any message sent to this address will go in the garbage without m y ever knowing it arrived. Sorry... <http://www.sonic.net/~dakidd> for more in fo
Post Follow-up to this messageDon Bruder wrote: > Ian Collins <ian-news@hotmail.com> wrote: ... snip ... > > Quite possibly not, since Usenet is a best-effort, asynchronous > distribution system that makes absolutely no promises whatsoever > that any specific message will reach any given server in any > particular amount of time. Depending on the route it has to take, > the newsgroup(s) it's posted to, the time of day it was posted, > and many other variables including how the destination server > (and any servers between the one you posted on and the > destination) is configured, a message you post to your news > server might be seen on a different server within seconds. Or it > could take anywhere from minutes to ws to get there. Assuming > it ever makes the trip at all... Precisely. And, since the normal transmission time is often measured in seconds or minutes, most people totally forget this fact, fail to properly quote, etc. etc. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. -- Posted via a free Usenet account from http://www.teranews.com
Post Follow-up to this messageOn Wed, 02 Apr 2008 17:23:03 +1300, Ian Collins <ian-news@hotmail.com> wrote in comp.lang.c: > Jack Klein wrote: > Didn't you see the clarification I posted an hour earlier? Actually, I didn't, nor Don Bruder's reply that prompted it, otherwise I would not have posted the amplification. SuperNews just switched their servers on March 31, and my feed has been a bit spotty since. Hopefully they'll have it squared away in another day or two. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.