How to use regular expression without using the Regex class?

0

I need to validate the input of values and strings, however I have questions about how to use without using the Regex class, how can I get the solution?

var CampoExpressao = new Regex(@"[0-9]");

Above is a regular expression example code.

    
asked by anonymous 04.05.2018 / 02:06

1 answer

2

Good evening, my friend. I think you are confusing with Javascript. In Javascript it is possible to create a regular expression only the closed pattern between bars

var re = /ab+c/;

or with the RegExp class

var re = new RegExp("ab+c");

Source: link

In C # you will always use the Regex class.

For more information, see the official Microsoft .NET Regular Expressions Guide, which you can find here

    
04.05.2018 / 04:26