zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

RegEx Support #101

Closed stonstad closed 3 years ago

stonstad commented 3 years ago

Is there support for RegEx? If so, how does one go about using/integrating it?

JonathanMagnan commented 3 years ago

Hello @stonstad ,

What do you mean by RegEx support? It should always be supported.

Example:

string input = "Hello   World   ";
string pattern = "\\s+";
string replacement = " ";

var result = Eval.Execute(@"Regex rgx = new Regex(pattern); return rgx.Replace(input, replacement);", new {pattern, input, replacement});

Let me know if you still have an issue to use it or if everything is fine.

Best Regards,

Jon

JonathanMagnan commented 3 years ago

Hello @stonstad ,

Since our last conversation, we haven't heard from you!

Did you get the chance to look at the example?

Don't hesitate to contact us with any questions or further assistance,

Jon

stonstad commented 3 years ago

Yes, it works great. Thank you!