Skip to content

Commit e0d1658

Browse files
Added Regex to EZHelp
1 parent 7863ca3 commit e0d1658

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

EZCode/EZHelp.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,5 +665,12 @@ public float Power(object _val, object _pow)
665665
public string Substring(object text, object index, object length) => StringParse(text).Substring(IntParse(index), IntParse(length));
666666
public bool StartsWith(object text, object val) => StringParse(text).StartsWith(StringParse(val));
667667
public bool EndsWith(object text, object val) => StringParse(text).EndsWith(StringParse(val));
668+
public bool RegexMatch(object _text, object _match)
669+
{
670+
string input = StringParse(_text);
671+
string oattern = StringParse(_match);
672+
var match = System.Text.RegularExpressions.Regex.Match(input, oattern);
673+
return match.Success;
674+
}
668675
}
669676
}

TestEnv/Code.ezcode

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
include main
22

3-
print 'str startswith : Hello World, He'
3+
bool match new => regexmatch : hello, hi|hello
4+
5+
print 'match'

0 commit comments

Comments
 (0)