in reply to Re: Regex to match an IP address that is embedded inside of another string
in thread Regex to match an IP address that is embedded inside of another string

Thank you for your prompt response. The colon and other hex characters will always follow the last octet. I Tried your suggestion, and it still matches other ips that begin the same way on the fourth octet. Here is how I modified my code

if ($linebuf =~ /\d+\.$oc1\.$oc2\.$oc3\.$oc4:*/
  • Comment on Re^2: Regex to match an IP address that is embedded inside of another string
  • Download Code

Replies are listed 'Best First'.
Re^3: Regex to match an IP address that is embedded inside of another string
by stevieb (Canon) on Apr 19, 2016 at 22:30 UTC

    As I stated in my above post, you need to get rid of the *.

      Thank you, that did it. I also had to add "^" at the beginning of my RegEx<\p>