I have executed the code below, but its result is false. Is my pattern is correct? What is wrong here? If I am wrong please correct me because I am stuck on this.
String name = "] RESPONSE GET - 192.168.200.121 -";
string pat = "] RESPONSE (GET|GETNEXT|GETBULK|SET|TRAP) - ^192\\.168\\.200\\.121$ -";
Pattern p = Pattern.compile(pat);
Matcher m = p.matcher(name);
System.out.println(m.find());
^and$characters - indicating start of string and end of string respectively - in the middle of your pattern. That's never going to work. What are you actually trying to do with the IP address here?] RESPONSE...and start also with192\\.? Remove the^and$