1. The purpose of this post
I would demo how to use java to extract the Url/Ip/Email from a string.
For example, we have a String like this:
We want to get this result:
3. Solution and Code
Let’s use a Patterns.java from android.util
Then , we can add an InfoExtractor.java to do the job:
Now let’s do some test:
Then we get this result:
The code can be found in the github project.