I need to build some kind of "java syntax" compiler in university. I want to use regex to match variable type and variable name (int num , String str etc.). So I need the regex to match one of the var types (String, int, char, boolean, double) and after that at least one space and var name, but var name CAN NOT be one of those types. How do I do that? I tried:
(String|int|char|boolean|double)[\s]+([a-zA-Z]+[\w]*^(String|int|char|boolean|double))
I know its not java regex syntax (only one '\' instead of two), but I tried this in http://regexpal.com/ and it doesn't work.
Thanks a lot!