Skip to content

Commit 463dad6

Browse files
committed
Fixed issue exposed by added test
1 parent af04f8a commit 463dad6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

StringRegExpSplit.au3

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Func StringRegExpSplit($sString, $sPattern, $iLimit = 0, $iFlags = $PREG_SPLIT_N
3939
Local $aValue = [$sValue, $iPrevOffset]
4040
$sValue = $aValue
4141
EndIf
42-
If (Not BitAND($PREG_SPLIT_NO_EMPTY, $iFlags)) Or (Not $sValue == "") Then
42+
If (Not BitAND($PREG_SPLIT_NO_EMPTY, $iFlags)) Or (Not $sValue = "") Then
4343
ReDim $aReturn[UBound($aReturn, 1) + 1]
4444
$aReturn[UBound($aReturn, 1) - 1] = $sValue
4545
EndIf

tests/test.au3

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ assertEquals($expected, StringRegExpSplit("0|1|2|3|4|5|6|7|8|9", "\|", 2, $PREG_
3535

3636
Global $expected = ["0", "|", "|", "1||2||3||4||5||6||7||8||9"]
3737
assertEquals($expected, StringRegExpSplit("0||1||2||3||4||5||6||7||8||9", "(\|)(\|)", 2, $PREG_SPLIT_DELIM_CAPTURE))
38+
39+
Global $expected = [StringFormat("Array (\n"), StringFormat(" '0' => 1\n"), ")"]
40+
assertEquals($expected, StringRegExpSplit(StringFormat("Array (\n '0' => 1\n)"), "(.*\R)", 0, BitOR($PREG_SPLIT_DELIM_CAPTURE, $PREG_SPLIT_NO_EMPTY)))

0 commit comments

Comments
 (0)