I'm working on an app that needs to accept a RegEx from the user, to do so I'm using the following code:
Regex user_searchPattern = new Regex(this.userInput_regEx.Text);
Is doing this safe?
Is there a need to sanitize the user input, and if so how?
You might get an error if the regular expression has an invalid syntax or it might consume a exponential amount of time and space when processed if a so-called pathological regular expression is tested on some particular string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With