Current location - Quotes Website - Team slogan - Extracting IP from java regular expressions
Extracting IP from java regular expressions
Analyze the composition of IP address: numbers and "."

Then regularization can be written as follows: [0-9. ]+

According to your supplement, then IP can be written like this: [0-9. :]+@, including port number.

If you don't want the port number, you can write [0-9. ]+Like this:

I haven't studied Java, but regular expressions are generally universal.

As for the de-duplication in such a long text, I personally think that we should not only use regular expressions, but also cooperate with the program. As I am not a java programmer, it is difficult to explain. However, you can solve it by comparing the text repeatedly.

For example, IP: 218.98.195.19. It is estimated that there should be methods such as indexOf in java, so find them out and filter them.

For reference only.