Modify

Opened 6 years ago

Last modified 5 years ago

#2370 assigned Feature Request

StringReplace & StringRegExpReplace Add Offset\The starting position of the search

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

Description

would be very useful to add the "Offset\The starting position of the search" in StringReplace\StringRegExpReplace to work much more faster with strings

it seems that in xxx works really well and quickly, instead ddd does not work well in almost as if it does not work at all

Local $sFileData, $iString, $iTimerDiff

$sFileData =  FileRead(@DesktopDir& "\test.ini") ; test.ini = 10 Mb - includes inside, the string TestXXXX

$iTimerDiff = TimerInit()
$iString = StringInStr($sFileData, "TestXXXX", 1, 1, 2767600)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX")
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX", 0, 2767600)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

2767692 - 0.00829366853445348
1 - 34.3946332855723
1 - 29.7493890330846

however looking at the speed of StringInStr, and also have this option in StringReplace\StringRegExpReplace would be really helpful

Sorry for my english

Ciao.

Attachments (0)

Change History (6)

comment:1 Changed 6 years ago by TicketCleanup

  • Version 3.3.8.1 deleted

Automatic ticket cleanup.

comment:2 Changed 6 years ago by DXRW4E

sorry, post by mistake

it seems that in StringInStr works really well and quickly, instead StringRegExp does not work well in almost as if it does not work at all

Local $sFileData, $iString, $iTimerDiff

$sFileData =  FileRead(@DesktopDir& "\test.ini") ; test.ini = 10 Mb - includes inside, the string TestXXXX

$iTimerDiff = TimerInit()
$iString = StringInStr($sFileData, "TestXXXX", 1, 1, 2767600)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX")
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX", 0, 2767600)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

2767692 - 0.00829366853445348
1 - 34.3946332855723
1 - 29.7493890330846

Ciao.

comment:3 Changed 6 years ago by James

DXRW4E, are you using the latest beta? The regex compiler that AutoIt uses has been updated. Can you give that a go please?

comment:4 Changed 6 years ago by DXRW4E

Yes, I always use the latest Beta, where I noticed that StringRegExpReplace has been improved a lot about the speed in the Case-sensitivity Mod, however have a flag "Offset\The starting position of the search" in StringReplace or in StringRegExpReplace,
as in StringInStr and StringMid that working really fast, would be really helpful

Ciao.

comment:5 Changed 6 years ago by DXRW4E

Local $sFileData, $iString, $iTimerDiff

$sFileData =  FileRead(@DesktopDir& "\fff.inf") ; test.ini = 11 Mb - includes inside, the string TestXXXX

$iTimerDiff = TimerInit()
$iString = StringInStr($sFileData, "TestXXXX", 1, 1, 7188000)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX")
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)

$iTimerDiff = TimerInit()
$iString = StringRegExp($sFileData, "TestXXXX", 0, 7188000)
$iTimerDiff = TimerDiff($iTimerDiff)
ConsoleWrite($iString & " - " & $iTimerDiff & @LF)


;~ >Running:(3.3.9.15):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\Users\DXRW4E\Desktop\New AutoIt v3 Script (Beta).au3"    
;~ --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
;~ 7188325 - 0.0319898769811509
;~ 1 - 37.974748533896
;~ 1 - 28.9295120832874
;~ +>08:32:23 AutoIt3.exe ended.rc:0

;~ >Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\DXRW4E\Desktop\New AutoIt v3 Script (Beta).au3"    
;~ --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
;~ 7188325 - 0.0157974701141486
;~ 1 - 101.169368231525
;~ 1 - 87.8702680159286
;~ +>08:31:58 AutoIt3.exe ended.rc:0

comment:6 Changed 5 years ago by BrewManNH

  • 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.