Skip to content

Commit 41f8abb

Browse files
committed
Fix regexp_substr expression to correctly return only first matched group, not entire matched string
1 parent 33c288a commit 41f8abb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/qgsexpression.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ static QVariant fcnRegexpSubstr( const QVariantList& values, const QgsFeature* ,
688688
if ( re.captureCount() > 0 )
689689
{
690690
// return first capture
691-
return QVariant( re.capturedTexts()[0] );
691+
return QVariant( re.capturedTexts()[1] );
692692
}
693693
else
694694
{
@@ -1661,7 +1661,7 @@ bool QgsExpression::needsGeometry()
16611661

16621662
void QgsExpression::initGeomCalculator()
16631663
{
1664-
if( mCalc )
1664+
if ( mCalc )
16651665
return;
16661666

16671667
// Use planimetric as default
@@ -1671,7 +1671,7 @@ void QgsExpression::initGeomCalculator()
16711671

16721672
void QgsExpression::setGeomCalculator( QgsDistanceArea &calc )
16731673
{
1674-
if( !mCalc )
1674+
if ( !mCalc )
16751675
mCalc = new QgsDistanceArea();
16761676

16771677
// Copy from supplied calculator

0 commit comments

Comments
 (0)