[Mono-dev] Rexgular expressions bug

Manuel de la Pena mandel at themacaque.com
Mon Mar 16 13:39:59 EDT 2009


Hello there, 

I believe I have found a bug as well but I do not know if it has been
filled yet. The following throws an exception "Argument is out of
range." while on Microsofts .Net runtime works as expected (we can
access the named groups).

private def ParseErrorLine() as System.CodeDom.Compiler.CompilerError:
                error = System.CodeDom.Compiler.CompilerError()
                #errors are of the form "file(row,
column):ErrorNum:Type:message"
                data =
@/(?<file>.*boo)\((?<row>[0-9]+),(?<column>[0,9]+)\):(?<message>.*)/.Matches("/home/mandel/Code/boo/boo-nant/boo-nant/BooNantInclude.boo(63,9): BCE0005: Unknown identifier: 'supr'.")
                error.ErrorText = data[0].Groups["message"].Value
                error.FileName = data[0].Groups["file"].Value
                error.Line = int.Parse(data[0].Groups["row"].Value)
                error.Column = int.Parse(data[0].Groups["column"].Value)
                if error.ErrorText.Contains("WARNING"):
                        error.IsWarning = true
                return error

The code is written in boo but I have tested the C# equivalent and the
results are the same. It looks like it the regex tries to match the
group names rather than ignoring them.

Kr,

manuel => mandel



More information about the Mono-devel-list mailing list