Skip to content
Permalink
Browse files
Fix ported regular expression logic in the OGC utils class
  • Loading branch information
nirvn authored and nyalldawson committed Jul 16, 2021
1 parent 297dcfe commit 19849a772e3a2a87df02b1b0352add773019804d
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/core/qgsogcutils.cpp
@@ -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 );
@@ -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 );

0 comments on commit 19849a7

Please sign in to comment.