Modify

Opened 3 years ago

Last modified 3 years ago

#3922 assigned Bug

Problems with ".+" and ".+?" in regular expressions

Reported by: aacn Owned by: Jon
Milestone: Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

My English is not good, please forgive me, I have to use google translate.

Local $sString = 'ABC'
For $i = 1 To 999999
	$sString &= 'xxxxxxxxxx'
Next
$sString &= 'xxxxxxxx'	;Here if you add 1 or more characters, the following expressions use .+? No match, but .+ can match
$sString &= 'DEF'

For $i = 1 To 999999
	$sString &= 'xxxxxxxxxx'
Next
$sString &= 'xxxx'	;Here if you add 1 or more characters, the following expressions use .+ No match, but .+? can match

;~ Local $aRegExp = StringRegExp($sString, 'ABC.+DEF', 1)
Local $aRegExp = StringRegExp($sString, 'ABC.+?DEF', 1)
If Not @error Then
	MsgBox(64, StringLen($aRegExp[0]), StringLen($sString) - StringLen($aRegExp[0]))
Else
	MsgBox(48, '', 'no match')
EndIf

It looks like this problem occurs when it is longer than about 10 megabytes.

Attachments (0)

Change History (2)

comment:1 by aacn, 3 years ago

Hi all, it seems that one description should be changed, the last 10 megabytes should be the "length".
When the front part of the string exceeds this length, or the latter part exceeds this length, it will affect the matching of .+ and .+? respectively.

comment:2 by J-Paul Mesnage, 3 years ago

Owner: set to Jon
Status: newassigned

Modify Ticket

Action
as assigned The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.