Here is what I need to do:
I have a lengthy string that bears the form
com.example.TEXT A TO BE EXTRACTED at com.example.TEXT B to be extracted at org.xample.SOME OTHER TEXT at...
I would like to get
TEXT A TO BE EXTRACTED
TEXT B TO BE EXTRACTED
- ...
but not SOME OTHER TEXT
I am not terribly good at regexes and not at all so in Java. In JavaScript I can get the first match as
var re = /com\.example\.(.*) at/;
s = 'com.example.abcde at';
var m = s.match(re);
which would yield àbcdein
m[1]`
How can I
do the equivalent in Java
get all matches
The context here is an Android app. I have come across references to the Apache StringUtils class and its stringbetween
method. Quite apart from the fact that I cannot locate the relevant JAR file, I would really like to avoid inflating my app with one more JAR just for this need.
I should mention that I am using Java 8 and do not need to target anything less than Android 4.4.2.