﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2460	_StringBetween bug when $sStart = $sEnd	jchd18	Jpm	"{{{
Local $aRes = _StringBetween(""abbbaccca"", ""a"", ""a"")
; ""bbb"" is between ""a"" and ""a"" and is returned OK
; ""ccc"" is also between ""a"" and ""a"" but is not returned _ArrayDisplay($aRes)
}}}

I propose the following change to fix this case:
{{{
Local $aRes = _StringBetween(""abbbaccca"", ""a"", ""a"")
; ""bbb"" is between ""a"" and ""a""
; ""ccc"" is also between ""a"" and ""a"" and is now returned
_ArrayDisplay($aRes)

; #FUNCTION# ====================================================================================================================
; Author ........: SmOke_N (Thanks to Valik for helping with the new StringRegExp (?s)(?i) issue)
; Modified.......: SmOke_N - (Re-write for speed and accuracy), jchd
; ===============================================================================================================================
Func _StringBetween($sString, $sStart, $sEnd, $fCase = Default)
	Local $sCase = ""(?"" & ($fCase ? ""i"" : """") & ""s)""

	; If you want data from beginning then replace blank start with beginning of string
	$sStart = $sStart ? ""\Q"" & $sStart & ""\E"" : ""\A""

	; If you want data from a start to an end then replace blank with end of string
	$sEnd = $sEnd ? ""(?=\Q"" & $sEnd & ""\E)"" : ""\z""

	Local $aReturn = StringRegExp($sString, $sCase & $sStart & ""(.*?)"" & $sEnd, 3)
	If @error Then Return SetError(1, 0, 0)
	Return $aReturn
EndFunc   ;==>_StringBetween
}}}"	Bug	closed	3.3.9.22	Standard UDFs	3.3.9.21	None	Fixed		
