[Mono-bugs] [Bug 79470][Nor] New - Regex does not handle octal escapes starting with a value other than 0
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Sep 22 07:26:11 EDT 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by glen.ford at spinvox.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79470
--- shadow/79470 2006-09-22 07:26:11.000000000 -0400
+++ shadow/79470.tmp.23795 2006-09-22 07:26:11.000000000 -0400
@@ -0,0 +1,112 @@
+Bug#: 79470
+Product: Mono: Class Libraries
+Version: 1.1
+OS: other
+OS Details: SuSe 10.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: glen.ford at spinvox.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Regex does not handle octal escapes starting with a value other than 0
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Attempting to perform a regex search using octal escape characters that
+start with a digit other than 0 will generate an exception.
+
+Using mono 1.1.16.1
+
+e.g. \077 is ok, however \100 will throw an exception
+
+Steps to reproduce the problem:
+1. Using the following code
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace Test
+{
+ public class TheRegex
+ {
+
+ public static void Main( string[] args )
+ {
+
+ Regex myRegex;
+ string inputString;
+ string resultString;
+
+ // this should replace the instance of \077 (0x003F)
+ // with the letter t
+
+ myRegex = new Regex( @"\077" );
+ inputString = "asdf\u003Fasdf";
+ resultString = myRegex.Replace( inputString, "t" );
+ Console.WriteLine( "[" + inputString + "] becomes [" +
+resultString + "]" );
+
+ // this should replace the instance of \100 (0x0040)
+ // with the letter t
+
+ myRegex = new Regex( @"\100" );
+ inputString = "asdf\u0040asdf";
+ resultString = myRegex.Replace( inputString, "t" );
+ Console.WriteLine( "[" + inputString + "] becomes [" +
+resultString + "]" );
+
+ }
+ }
+}
+
+
+2. Build the above code
+
+mcs testRegex.cs
+
+3. Execute the above code
+
+mono testRegex.exe
+
+
+Actual Results:
+
+[asdf?asdf] becomes [asdftasdf]
+
+Unhandled Exception: System.ArgumentException: parsing "\100" - Reference
+to undefined group number 100
+Parameter name: \100
+ at System.Text.RegularExpressions.Syntax.Parser.ResolveReferences ()
+[0x00000]
+ at System.Text.RegularExpressions.Syntax.Parser.ParseRegularExpression
+(System.String pattern, RegexOptions options) [0x00000]
+ at System.Text.RegularExpressions.Regex.Init () [0x00000]
+ at System.Text.RegularExpressions.Regex..ctor (System.String pattern,
+RegexOptions options) [0x00000]
+ at System.Text.RegularExpressions.Regex..ctor (System.String pattern)
+[0x00000]
+ at Test.TheRegex.Main (System.String[] args) [0x00000]
+
+
+Expected Results:
+
+[asdf?asdf] becomes [asdftasdf]
+[asdf?asdf] becomes [asdftasdf]
+
+
+How often does this happen?
+
+Everytime
+
+
+Additional Information:
+
+Have tested on .Net and the Expected Results are generated.
More information about the mono-bugs
mailing list