By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,911 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,911 IT Pros & Developers. It's quick & easy.

Easy to use regular expression library for speech control jukebox

P: n/a
Hi,

I'm finishing up developing a speech control jukebox (see
intelligentjukebox.com)

Can anyone point me to the easiest to use free library that does very
basic regular expression matching and substitution? E.g. I need do
stuff like this: (perl expression follows)

$s =~ s/\&/and/g; # replace ampersands with "and"

I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?

Setting up libraries seems arcane and nonstandard to me. The language
is hard enough by itself. Is there any guide to this knowledge
anywhere?

So far I've tried unsuccessfully to set up these libraries:
http://www.tropicsoft.com/Components/RegularExpression/
http://www.psyon.org/projects/pcre-win32/

Thanks,
Jeff
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Jeff wrote:
Hi,

I'm finishing up developing a speech control jukebox (see
intelligentjukebox.com)

Can anyone point me to the easiest to use free library that does very
basic regular expression matching and substitution? E.g. I need do
stuff like this: (perl expression follows)

$s =~ s/\&/and/g; # replace ampersands with "and"
I don't know how far compatible boost.regex is with perl but thats one
free library that does basic stuff.
I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?


How the hell did you use the speech recognition library? Did you roll
your own?

Jul 23 '05 #2

P: n/a
Jeff wrote:
I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?


If your runtime environment includes posix c support, you could perhaps use
the standard regex routines?

#include <sys/types.h>
#include <regex.h>

int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t
nmatch,
regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t
errbuf_size);
void regfree(regex_t *preg);

Regards

Mads

--
Mads Bondo Dydensborg ma**@dydensborg.dk
http://www.madsdydensborg.dk/

"The government of the United States is not, in any sense, founded on
the Christian religion." -George Washington, November 4, 1796

"No, I don't know that Atheists should be considered as citizens, nor
should they be considered patriots. This is one nation under God."
-George H. W. Bush

Jul 23 '05 #3

P: n/a
On Sat, 23 Jul 2005 10:24:38 +0200, Mads Bondo Dydensborg
<ma*****@challenge.dk> wrote:

If your runtime environment includes posix c support, you could perhaps use
the standard regex routines?

#include <sys/types.h>
#include <regex.h>

int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t
nmatch,
regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t
errbuf_size);
void regfree(regex_t *preg);


Thanks, I like this solution best. I added the includes, but I get a
compile error. Do you know how I can fix this?
---------------------------

Deleting intermediate files and output files for project 'IntelliMusic
- Win32 Release'.
--------------------Configuration: IntelliMusic - Win32
Release--------------------
....

J:\program files\Microsoft Visual
Studio6.0\VC98\MFC\INCLUDE\afxtempl.h(1233) : error C2668: 'memset' :
ambiguous call to overloaded function
J:\program files\Microsoft Visual
Studio6.0\VC98\INCLUDE\utility(21) : while compiling class-template
member function 'void __thiscall CMap<class CSAPrefsSubDlg *,class
CSAPrefsSubDlg *,unsigned long,unsigned long
&>::InitHashTable(unsigned
int,int)'

....
Generating Code...
Error executing cl.exe.

IntelliMusic.exe - 1 error(s), 0 warning(s)
---------------------------
I should probably post to a win32 ng now.
Jul 25 '05 #4

P: n/a
On 22 Jul 2005 15:33:29 -0700, u.********@gmail.com wrote:
Jeff wrote:
Hi,

I'm finishing up developing a speech control jukebox (see
intelligentjukebox.com)

Can anyone point me to the easiest to use free library that does very
basic regular expression matching and substitution? E.g. I need do
stuff like this: (perl expression follows)

$s =~ s/\&/and/g; # replace ampersands with "and"


I don't know how far compatible boost.regex is with perl but thats one
free library that does basic stuff.
I'm a fairly good using the c++ language, but I have little experience
setting up libraries, make files, etc. I'm using Visual C++ 6.0.
Isn't there any library where I can just add a few .cpp and .h files
to my code?


How the hell did you use the speech recognition library? Did you roll
your own?


Uhh, yes I did! I rolled my own SR library into a big fattie and
smoked it. Now its all gone! For now I'm stuck with M$.

Ok, this is what allowed me to use the ms sapi. Without this site I
never would have started my project.

SAPI 5.0 Tutorial I: An Introduction to SAPI
http://www.generation5.org/content/2001/sr00.asp

Jul 25 '05 #5

P: n/a
Jeff wrote:
If your runtime environment includes posix c support, you could perhaps
use the standard regex routines?
Thanks, I like this solution best. I added the includes, but I get a
compile error. Do you know how I can fix this?


no, sorry, my knowledge about Windows is really limited.

Good luck

Mads

--
Mads Bondo Dydensborg ma**@dydensborg.dk
http://www.madsdydensborg.dk/

I disapprove of what you say, but I will defend to the death your right to
say it.
- Beatrice Hall [pseudonym: S.G. Tallentyre], 1907 (many times wrongfully
attributed to Voltaire)

Jul 25 '05 #6

P: n/a
>>>If your runtime environment includes posix c support, you could perhaps
use the standard regex routines?

Thanks, I like this solution best. I added the includes, but I get a
compile error. Do you know how I can fix this?


no, sorry, my knowledge about Windows is really limited.


Windows is not POSIX compliant and has no built-in regular expression
library.

You'll have to go find one. Henry Spencer wrote one for wxWidgets which is
freely available. PCRE (Perl-compatible regular expressions) lib is free and
has C++ wrappers. These things can be found with Google.

--John Ratliff
Jul 26 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.