[Mono-bugs] [Bug 78295][Nor] New -
System.Text.RegularExpression.Regex not supporting
RegexOptions.RightToLeft
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu May 4 12:49:27 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 russell.kay at realtimeworlds.com.
http://bugzilla.ximian.com/show_bug.cgi?id=78295
--- shadow/78295 2006-05-04 12:49:27.000000000 -0400
+++ shadow/78295.tmp.21767 2006-05-04 12:49:27.000000000 -0400
@@ -0,0 +1,99 @@
+Bug#: 78295
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Mac OS X 10.3
+OS Details: 10.4.6
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: Russell.Kay at realtimeworlds.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Text.RegularExpression.Regex not supporting RegexOptions.RightToLeft
+
+Description of Problem:
+Currently an exception is thrown if RegExOptions.RightToLeft is specified
+on a regular expression.
+
+Steps to reproduce the problem:
+1. compile the program below using gmcs
+2. run it using mono
+3.
+
+Actual Results:
+The regular expression that uses the option RightToLeft will cause an
+exception on mono.
+
+
+Expected Results:
+Both regular expressions will be executed without any exceptions.
+The test works fine on Windows - even if compiled with gmcs.
+
+How often does this happen?
+all the time.
+
+Additional Information:
+Cheetah is the fastest land animal.
+
+---- cut from here ----
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace Test
+{
+ class RegExTest
+ {
+
+ public static string substitute( Match _m )
+ {
+ string ret = null;
+ string innerString = _m.Value.Substring( 2, _m.Length - 3 );
+ switch( innerString )
+ {
+ case "foo":
+ ret = "bar";
+ break;
+ case "hello":
+ ret = "world";
+ break;
+ } // end switch
+
+ if (ret == null) {
+ ret = "ERROR";
+ } // end if
+
+ return ret;
+ } // end substitute
+
+ public static string resolve( string _value, Regex _regex )
+ {
+ string ret = _value;
+ MatchEvaluator eval = new MatchEvaluator( substitute );
+ do {
+ ret = _regex.Replace( ret, eval);
+ } while( _regex.IsMatch(ret) );
+ return ret;
+ } // end resolve
+
+
+ static void Main( string[] _args )
+ {
+ Regex regexpLR = new Regex("\\@\\([^\\)]*?\\)" );
+ Regex regexpRL = new Regex("\\@\\([^\\)]*?\\)",
+RegexOptions.RightToLeft);
+
+ string testString = "@(foo) @(hello)";
+ System.Console.WriteLine( "Regex Left to Right {0} = {1}",
+testString, resolve( testString, regexpLR ) );
+ System.Console.WriteLine( "Regex Right to Left {0} = {1}",
+testString, resolve( testString, regexpRL ) );
+ } // end Main
+ }
+}
More information about the mono-bugs
mailing list