I am trying to write a regular expression for the following scenario.
It could be simple alphanumeric string (It can have ‘@’ even if it is special character) or alphanumeric string followed by argument list in parenthesis or alphanumeric string followed by blank parenthesis:
- My_macro -> accept this
- My_macro() -> accept this
- My_macro(arg1, arg2, arg3) -> accept this
I am new to regular expression, I read some tutorials and could form this regular expression.
([a-zA-Z]+[a-zA-Z0-9_@]*) | ([a-zA-Z]+[a-zA-Z0-9_@.]+[\(][a-zA-Z]+[a-zA-Z0-9_@,]+[\)])
This isn’t working.
matches:
The question is what exactly are you trying to achieve. Why do you need to match these strings? Your requirements matches most strings anyways.