ex_04.bmx Unhandled Exception:( -99 ) ...

BlitzMax Modules Forums/Brucey's Modules/ex_04.bmx Unhandled Exception:( -99 ) ...

Hi getting the following error message:

Unhandled Exception:( -99 ) ternal error: code overflow

This is using the BaH.libcurlssl ex_04.bmx file on my own server.

I have traced the error down to the regex parser, here is a small test app that recreates the problem using the regex expression and string that triggers it...

' Recreate FTP Parsing Error

SuperStrict

Framework BaH.RegEx
Import BRL.StandardIO

Local dir:String = "drwxr-xr-x    2 merx19  merx19      4096 Nov  1 07:47 . "

Local regex:TRegEx = TRegEx.Create("(.*;[0-9]+)\\s*(\\d+)/\\d+\\s*(\\d{1,2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-([0-9]{4})\\s*((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s*\\[(([0-9$A-Za-z_]+)|([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+))\\]?\\s*\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\)")

Try
	Local match:TRegExMatch = regex.Find(dir)
		
	Print "Found : " + match.SubExp()
		
Catch e:TRegExException

	Print "Error : " + e.toString()
	End
	
End Try

Print "Done."


Managed to trim down the Regular expression to the following and still get the error, if this helps!

' Search for a floating point number in a string

SuperStrict

Framework BaH.RegEx
Import BRL.StandardIO

Local floats:String = "drwxr-xr-x    2 merx19  merx19      4096 Nov  1 07:47 . "
Print "Original : " + floats + "~n"

'Local regex:TRegEx = TRegEx.Create("(.*;[0-9]+)\\s*(\\d+)/\\d+\\s*(\\d{1,2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-"+..
'					  "([0-9]{4})\\s*((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s*\\[(([0-9$A-Za-z_]+)|([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+))\\]")

Local regex:TRegEx = TRegEx.Create("\\[(([0-9$A-Za-z_]+)|([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+))\\]")



Try

	Local match:TRegExMatch = regex.Find(floats)
		
	' get each match, and print it out.
	While match
	
		Print "Found : " + match.SubExp()
		
		match = regex.Find()
	Wend
	
	If Not match Then Print "No Match found"

Catch e:TRegExException

	Print "Error : " + e.toString()
	End
	
End Try

Print "Done."


As soon as you trim down the expression to exclude the "\\[" and "\\]" it works and detects groups of chracters!

I believe the "\\[" and "\\]" just test for square bracket chracters so I'm not sure why this fails?

Yeah, I think there's an issue in PCRE with too-deep recursion on the stack. (So I'll look into updating that, as well as seeing a way to stop the error if possible).

However... ;-)
... your regex is flawed :-p

You don't need the double slashes (\\) in BlitzMax, only C, since blitz doesn't use slash as an escape character. Removing those fixes the overflow error.
It won't find anything though, since the expression is looking for a differently formated "ls" output than you are testing it with.
You'll find if you remove that semi-colon (too) things will improve a little.

Anyhoo, if you were to use a string such as :
Local dir:String = "qasd 32/02/2222 05-Jan-2003 03:03:03 weASwer"

with a regex like

Local regex:TRegEx = TRegEx.Create("(.*[0-9]+)\s*(\d+)/\d+\s*(\d{1,2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-([0-9]{4})\s*((?:[01]\d)|(?:2[0-3])):([012345]\d):([012345]\d)\s*([a-zA-Z]*)")

you would at least get a match...

But I ain't no expert...

Hi Brucey, excellent!

Only the error is from the BaH.libcurlssl example 4 when pointed at my website.

The regex is taken from that used by the BaH.ftpparser in the vmsparser.bmx file, downloaded today from website/googlecode!

I tried it without the double \ and it worked!

Great work with the modules Brucey, now onto automating my weblog extraction process!

Cool.. I'll sort *my* expressions out then ;-)