Jump to content

Max length of StringRegExp return value


Recommended Posts

Anyone know if there is a maximum length of StringRegExp return value? I am stripping out parts of a couple of webpages and the biggest webpage never returns a match even though it has the same structure as a smaller one that does work. It appears that the @Error is 'ok' and the @extended is 'Match found', but the return value is an empty string.

Anyone seen the same?

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

Anyone know if there is a maximum length of StringRegExp return value? I am stripping out parts of a couple of webpages and the biggest webpage never returns a match even though it has the same structure as a smaller one that does work. It appears that the @Error is 'ok' and the @extended is 'Match found', but the return value is an empty string.

Anyone seen the same?

@Stumpii,

I recall someone here just posted a chart giving the size limits of AutoIt. Do a search.

Also, show us some of your code so far.

BTW- Regular Expressions as being revamped. Read up on that as well

ViM

Link to comment
Share on other sites

@Stumpii,

I recall someone here just posted a chart giving the size limits of AutoIt. Do a search.

Also, show us some of your code so far.

BTW- Regular Expressions as being revamped. Read up on that as well

ViM

I could not find anything related to the StringRegExp size limit in the forums, or the AutoIt help. I cannot find any info on an updated StringRegExp function either. It appears the Nutster is working on it, but I cannot find anything else out but that. I will send him a PM.

Here is the regular expression pattern I am using:

(<div[^>]*?id="MainBody".*?<!--End "MainBody"-->)

And here is the data I am searching in (cut down include the data I want plus a couple of line before and after). Note that this has been chopped down, so that it actually works. Add a few chars in the middle and it will stop working.

CODE

<td class="right" valign="top" width="30">

<div editable="true" id="MainBody"><table style="width: 683px; height: 590px;" border="0" cellpadding="0" cellspacing="0">

<tbody>

<tr style="font-family: Terminal;">

<td style="width: 550px;" class="mainheader" align="center">

<h2 style="height: 24px;">AutoIt Debugger</h2>

</td>

</tr>

<tr>

<td style="width: 550px;" class="main" align="center" valign="top"><br>

<table style="width: 652px; height: 553px;" border="0" cellpadding="0" cellspacing="0">

<tbody>

<span style="color: rgb(255, 0, 0);">UNDER CONSTRUCTION - LINKS DO NOT WORK!!!</span></span></big>

<p style="font-weight: bold;"><big><span style="font-weight: bold;">Features:</span></big></p>

<big><span style="font-weight: bold;">Installation:</span><br></big>

<ul>

<li style="width: 599px;"><big>The .Net GUI installer can be downloaded here: <a href="AutoIt_AutoIt_Debugger/Software/AutoIt_Debugger_GUI_v0.7.0_Setup.msi">AutoIt_Debugger_GUI_v0.7.0_Setup.msi</a></big></li>

<li style="width: 599px;"><big>The AutoIt installer can be downloaded here:</big> <a href="AutoIt_AutoIt_Debugger/Software/AutoIt_Debugger_Setup_v0.7.0.exe">AutoIt_Debugger_Setup_v0.7.0.exe</a></li>

</ul>

<big><span style="font-weight: bold;">Not supported (this may change in the future)/What it will not do:<br></span></big>

<big><span style="font-weight: bold;">Not supported (this may change in the fdfdd</span></big>

<li><big>When debugging programs with GUIs, single stepping the program will take you round a never ending message loop. It is better to set breakpoints for the messages that you want to capture and run the code instead of single stepping.<br></big></li>

<li><big>When modifying loops, the debugger will only stop at the start of the loop on the first pass. On later passes, the debugger jumps directly to the first line inside the loop. To modify the loop's variable, change the variable before the debugger jumps back to the start of the loop.</big></li>

<li><big>Note that running with system #include files significantly reduces the speed at which the debug file is created. This is something that I need to look into.<br></big></li>

</ul>

<big><span style="font-weight: bold;">How it works:<br></span></big>

<ul>

<li><big>Running the debug preparer adds a bunch of extra code into your script, including an #include file. The included file creates the COM debugger and contains most of the&nbsp;code to&nbsp;interface with the debugger. As the debugger is created by your script, as soon as your script closes, so does the debugger.</big></li>

</ul>

<big><span style="font-weight: bold;">Screen shot:<br>

<br></span> Referring to the graphic:</big>

<ul>

<li><big>The user's script is displayed on the left hand side. There are seperate tabs for each #include file.</big></li>

<li><big>The check boxes allow a breakpoint to be set or removed for each line. The line to be executed next is shown highlighted (in faint grey).</big></li>

<li><big>The right hand side shows all the variables and values used so far in the script. Values that changed since the last step are in red. Double clicking on a variable allows you to change its value.</big></li>

<li><big>There are buttos to run the script until a breakpoint is hit, single step through the script, or single step through the script jumping any calls to functions.</big></li>

</ul>

<br>

<img style="width: 638px; height: 536px;" src="AutoIt_AutoIt_Debugger/Images/Changing_Variables.jpg" alt=""><br>

<big><span style="font-weight: bold;">Source Code:<br>

<br></span></big> <big>Here is the source code for the programs for those that are interested. It needs some more comments added, but don't all programs? The help file that is part of the install&nbsp;has a small section in the 'Basics' part about how the program works. The source is available here:</big> <big><a href="AutoIt_AutoIt_Debugger/Software/AutoIt_Debugger_Source_v0.8.0RC.zip">AutoIt_Debugger_Source_v0.8.0RC.zip</a><br></big></td>

</tr>

<tr>

<td style="height: 15px;"></td>

</tr>

</tbody>

</table>

</td>

</tr>

</tbody>

</table>

</div>

<!--End "MainBody"--></td>

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

  • Moderators

$file = @DesktopDir & '\test.txt'
$array = _SRE_BetweenEX(FileRead($file), 'id="MainBody"', 'End "MainBody"')
MsgBox(64, 'Info:', $array[0])

Func _SRE_BetweenEX($s_String, $s_Start, $s_End, $iCase = 'i')
    If $iCase <> 'i' Then $iCase = ''
    $a_Array = StringRegExp($s_String, '(?' & $iCase & _
                ':' & $s_Start & ')(.*?)(?' & $iCase & _
                ':' & $s_End & ')', 3)
    If @extended & IsArray($a_Array) Then Return $a_Array
    Return SetError(1, 0, 0)    
EndFunc
If you are just trying to get all the text between.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

$file = @DesktopDir & '\test.txt'
$array = _SRE_BetweenEX(FileRead($file), 'id="MainBody"', 'End "MainBody"')
MsgBox(64, 'Info:', $array[0])

Func _SRE_BetweenEX($s_String, $s_Start, $s_End, $iCase = 'i')
    If $iCase <> 'i' Then $iCase = ''
    $a_Array = StringRegExp($s_String, '(?' & $iCase & _
                ':' & $s_Start & ')(.*?)(?' & $iCase & _
                ':' & $s_End & ')', 3)
    If @extended & IsArray($a_Array) Then Return $a_Array
    Return SetError(1, 0, 0)    
EndFunc
If you are just trying to get all the text between.
Thanks, but I am try to get the data including the search term. I think that as StringRegExp is still being used, it will have the same problem of the maximum return data length.

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

  • Moderators

Thanks, but I am try to get the data including the search term. I think that as StringRegExp is still being used, it will have the same problem of the maximum return data length.

You've been around long enough I'm sure you could add to the beginning and the end of the return what you were looking for to get :P

On length, I've tried it on several MB's worth of stuff, and use SRE quite often now in everything I do, I've not run into a "Max" string issue as of yet.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

You've been around long enough I'm sure you could add to the beginning and the end of the return what you were looking for to get :P

On length, I've tried it on several MB's worth of stuff, and use SRE quite often now in everything I do, I've not run into a "Max" string issue as of yet.

I tried your version and it works fine. I retried my old code and it works as well. I guess there must have been some error somewhere in the code. Thanks for you help.

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...