Skip to content

Commit

Permalink
Fix ported regular expression logic in the OGC utils class
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Jul 16, 2021
1 parent 297dcfe commit 19849a7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/qgsogcutils.cpp
Expand Up @@ -3312,11 +3312,12 @@ QgsExpressionNodeBinaryOperator *QgsOgcUtilsExpressionFromFilter::nodeBinaryOper
}
const QRegularExpression rx( "[^" + QgsStringUtils::qRegExpEscape( escape ) + "](" + QgsStringUtils::qRegExpEscape( wildCard ) + ")" );
QRegularExpressionMatch match = rx.match( oprValue );
int pos = 0;
int pos;
while ( match.hasMatch() )
{
pos = match.capturedStart();
oprValue.replace( pos + 1, 1, QStringLiteral( "%" ) );
pos = match.capturedStart() + 1;
pos += 1;
match = rx.match( oprValue, pos );
}
oprValue.replace( escape + wildCard, wildCard );
Expand All @@ -3330,11 +3331,12 @@ QgsExpressionNodeBinaryOperator *QgsOgcUtilsExpressionFromFilter::nodeBinaryOper
}
const QRegularExpression rx( "[^" + QgsStringUtils::qRegExpEscape( escape ) + "](" + QgsStringUtils::qRegExpEscape( singleChar ) + ")" );
QRegularExpressionMatch match = rx.match( oprValue );
int pos = 0;
int pos;
while ( match.hasMatch() )
{
pos = match.capturedStart();
oprValue.replace( pos + 1, 1, QStringLiteral( "_" ) );
pos = match.capturedStart() + 1;
pos += 1;
match = rx.match( oprValue, pos );
}
oprValue.replace( escape + singleChar, singleChar );
Expand Down

0 comments on commit 19849a7

Please sign in to comment.