0

I am new to .NET regular expressions.

My regular expression below alerted too many ) at run time. I don't know how to handle the ()

input = "Get_MyAppList()"; Match match = Regex.Match(input, @"Get_([A-Za-z0-9\-]+)\()$", RegexOptions.IgnoreCase); 

2 Answers 2

7

You forgot to escape the last ) (just before the $):

@"Get_([A-Za-z0-9\-]+)\(\)$" 
Sign up to request clarification or add additional context in comments.

Comments

1

get some regex tool that will help you create regexes that provides regex check on the fly with hints about mistakes whereabouts, generic error messages aren't good enough often.

I can recommend Expresso that I use, remember that most tricky stuff has to be preceded by

\

when you create regex (except letters & numbers basicly) so for "()" to match you need \(\)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.