~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/Reports/ICSharpCode.Reports.Core/Project/Expressions/SimpleExpressionEvaluator/Compilation/Functions/Operators/NotRegexMatches.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
using System.Linq;
 
4
using System.Text;
 
5
using System.Text.RegularExpressions;
 
6
 
 
7
namespace SimpleExpressionEvaluator.Compilation.Functions.Operators
 
8
{
 
9
   
 
10
        [Tokens("!=~")]
 
11
        public class NotRegexMatches : BinaryOperator<bool>
 
12
        {
 
13
            protected override bool EvaluateOperation(object left, object right)
 
14
            {
 
15
                if (left == null && right == null)
 
16
                    return true;
 
17
 
 
18
                if (left == null || right == null)
 
19
                    return false;
 
20
 
 
21
                return !(Regex.IsMatch(left.ToString(), right.ToString(),RegexOptions.IgnoreCase));
 
22
            }
 
23
        
 
24
    }
 
25
}