I am trying to write a regular expression to parse a string that represents a function call. I want to parse:
createNewEmail(mailToJohn, recipientGeorge, Subject, content);
into an array of strings:
createNewMail,
mailToJohn,
recipientGeorge,
Subject,
content
Other possible inputs could be:
createNewEmail(mailToJohn, recipientGeorge, Subject, content);
makeTemplateUser(templateName, userName);
deleteEmail(emailToDelete);
updateUserSetting(userId, changedSettings, oldSettingsId);
How do you suggest I parse this?
If your input is really that simple, you can just use
It will work as long as none of your identifiers (function name or argument) are a single character long; if you need to handle that case just modify the
Wherefilter. This will return an array that you can just insert into your larger array (or add to a list, etc).