You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Khaled Noaman <kn...@ca.ibm.com> on 2002/01/02 21:30:08 UTC
Re: Problem with regular expressions
Hi Bojan,
The following should fix the infinite loop problem with patterns starting
with ".*".
Index: RegularExpression.cpp
===================================================================
@@ -1174,15 +1177,6 @@
XMLMutexLock lockInit(&fMutex);
compile(fTokenTree);
-
- if (fOperations->getOpType() == Op::CLOSURE &&
- fOperations->getChild()->getOpType() ==
Op::DOT) {
-
- Op* anchor = fOpFactory.createAnchorOp(isSet(fOptions,
SINGLE_LINE) ? chLatin_A
-
: chAt);
- anchor->setNextOp(fOperations);
- fOperations = anchor;
- }
Regards,
Khaled
Bojan Resnik wrote:
> Greetings, everyone.
>
> I see that the regular expression classes are not documented, but I
> still need to use them. However, I found that their behaviour is
> somewhat strange. Consider the program fragment below:
>
> #include <util/PlatformUtils.hpp>
> #include <util/regx/RegularExpression.hpp>
> ...
> void SomeFunction()
> {
> RegularExpression regexp(".*i.*", "X");
> regexp.matches("String");
> }
>
> If the option string doesn't contain "X", that all the comparisons I
> tried failed miserably, even those that were not supposed to fail. If
> "X" is specified, then most of the comparisons are executed correctly,
> but the above code enters an infinite loop. Actually, if the pattern
> begins with ".*" and "X" is specified as an option, the code will
> enter infinite loop.
>
> Is there a solution to this problem? I need regular expressions for
> the project I am working on.
>
> Best regards,
> Bojan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re[2]: Problem with regular expressions
Posted by Bojan Resnik <re...@EUnet.yu>.
> Hi Bojan,
> The following should fix the infinite loop problem with patterns starting
> with ".*".
Thank you, Khaled!
This has indeed solved the problem.
Best regards,
Bojan
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org