public void Parse_XModeComment_FlagSet_IgnoresComment() { var regex = RegularExpression.From( new Regex("abc # This is a comment", RegexOptions.IgnorePatternWhitespace) ).ToRegex(RegexOptions.IgnorePatternWhitespace); Assert.IsTrue(regex.IsMatch("abc")); }
public static void AssertRoundTrips(string regex, RegexOptions options = RegexOptions.None, string expected = null) { var result = RegularExpression.From(new Regex(regex, options)).ToRegex(options); Assert.AreEqual(expected ?? regex, result.ToString()); }
public void Parse_XModeComment_FlagNotSet_InterpretedAsLiteral() { var regex = RegularExpression.From(new Regex("abc # This is a comment")).ToRegex(); Assert.IsTrue(regex.IsMatch("abc # This is a comment")); }
public void Parse_InlineOptions_IgnoreWhitespace_StopsEscaping() { var regex = RegularExpression.From(new Regex(@"Yes escaping(?x)No escaping")).ToRegex(); Assert.IsTrue(regex.IsMatch("Yes escapingNoescaping")); }