ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Anyone have any links or examples of PCRE library usage in C? I've been hunting the net for them and all I can find is documentation on the API itself. It would be helpful to have an example or two. Thanks!
lol didn't even think of that. Thanks for the link. I've been reading that thing up and down trying to wrap my head around how to use it. I'm just about there. Only one issue left Thanks!
Unfortunately I don't know where the sample file they reference is
hmm. i dont know where it would be. a quick search showed that i have it in several places. it looks like the demo comes with php, apache, and also subversion.
if you have the source for any of those it should be in there. otherwise you could just download the pcre source..
only briefly. i was going to use it for some config file parsing, but passed on it. regex was just more than i needed for name value pairs that i had in the config file.
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495
Rep:
Quote:
Originally Posted by Centinul
lol didn't even think of that. Thanks for the link. I've been reading that thing up and down trying to wrap my head around how to use it. I'm just about there. Only one issue left Thanks!
Unfortunately I don't know where the sample file they reference is
after you do the man pcresample, as he told you to, you see that an example source code file name. Then:
locate pcredemo.c
find / -name pcredemo.c
for me, /usr/share/doc
I like that folder so much I added it to my gnome favorites/bookmarks in nautilus.
Anyone have any links or examples of PCRE library usage in C? I've been hunting the net for them and all I can find is documentation on the API itself. It would be helpful to have an example or two. Thanks!
The library comes with 'pcregrep' - that is, of course, an obvious source of examples.
I've used the C++ interface.
When I installed the package (on FreeBSD) it came with loads of HTML
documentation. I found it easy to grasp what I needed from it.
see fakie_flip's post eh?
have you checked if you have docs
maybe /usr/share/doc/pcre ?
BTW amazingly it's still not as fast as perl.
I've tried boost::regex, regex and pcre.
Last edited by bigearsbilly; 09-26-2010 at 05:21 PM.
Perl isn't just faster, It actually mashes C++ on regexes.
amazing really. I've done quite a bit of experimenting recently,
started with Boost, then std C libregex then PCRE.
always perl is significantly faster.
mainly using perl splitting into a list compared to C++ splitting into a vector of strings.
(the sort of stuff one needs in the real world)
even cheating in C++ and just printing results without assigning to data structures didn't
beat perl.
it's quite impressive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.