Is it possible to parse some Java code with regular expression?
So, let's say I need a list of int variables from this:
int abc1 = 1; int abc2 = abc1 + 1; int abd3 = abc1 + abc2;
And I want to put them in an ArrayList .
So something like this:
private void parse(String s){ List<List<String>> variables = new ArrayList<List<String>>(); list.add(new ArrayList<String>);
What I'm asking is that regex can solve this problem?
The reason for all this is that the user can have a little control over the application using a bit of code (Android app for Android)
If regex is not recommended, then which parser should I use?
source share