Modify

Opened 19 months ago

Last modified 18 months 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 Changed 19 months ago by aacn

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 Changed 18 months ago by Jpm

  • Owner set to Jon
  • Status changed from new to assigned

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as assigned The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.