Sirs,
In Java Netbeans, I am going to take a String entered by a user, extract all of the capital letter chars, and then load the capital letters into a new char[] array. The string is going to consist entirely of capital letters and mathematical/algebraic operators (e.g. {}/+^*!() ...).
It is clear to me that there are a variety of expressions involving match
and regular expressions -- this question has been addressed numerous times on this forum.
The problem that I am having is that every time a question similar to this has been asked, the solution was too specific to the OP's situation to be useful to me (e.g. the solution was only applicable to email addresses). Every time this question has been asked, the OP had considerable prior knowledge about what format the user input was going to come in.
In summary I am looking for a way to use regex
and/or match
, or anything else in Java Netbeans to pluck out all of the capital letters of an input string, irrespective of how scrambled up or mucked up the original string may be. For example if the user were to input:
a*j^A+=(B(({C}%A
The the resulting character string would be:
{"A", "B", "C", "A"}
Lastly, the tutorials I have come across at TutorialsPoint as well as the original documentation from Oracle are far too encyclopedic to be helpful. Searching for documentation on Regex produces enough reading material that it would take me days to dig through it all.
I'm more than capable of doing this in Python, just don't know how to do it in Java.
Regards,
Brent