[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnu-regexp-discuss] regexec() problem
From: |
hi_biswanath |
Subject: |
[Gnu-regexp-discuss] regexec() problem |
Date: |
Tue, 08 Jun 2004 15:27:10 +0530 |
I am using <regex.h>.
I have
string _text = "This is the way to go.";
string _findRegexp = "\\s+";
string _replaceRegexp = " ";
bool _caseSensitive = true;
bool _globalReplace = true;
int _flags = REG_EXTENDED;
int _executionFlags = 0;
if (!_caseSensitive) {_flags = _flags | REG_ICASE;}
regex_t _compiledRE;
regmatch_t *_reMatchesPtr = 0;
long _result = regcomp(&_compiledRE, _findRegexp.c_str(), _flags);
long _subexpressionCount = _compiledRE.re_nsub;
_reMatchesPtr = new regmatch_t[_subexpressionCount+1];
_result = regexec(&_compiledRE,
_text.data(),
_subexpressionCount + 1,
_reMatchesPtr,
_executionFlags);
Now, regexec() is in a loop to find and replace. And for the part 'go.' in
_text, regexec() returns 0 in gcc 2.96 and 1 in gcc 3.3.2.
Can someone please help?
I am clueless.
I will be very grateful for some help.
Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com
Bid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to
http://airsahara.indiatimes.com and Bid Now!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnu-regexp-discuss] regexec() problem,
hi_biswanath <=