#!/usr/bin/perl use strict; use warnings; my $output = "ae4.5784 up down inet 182.75.123.121/30"; if($output =~ m/(\d{1,3}\.\d{1-3}\.\d{1-3}\.\d{1-3})$/g) { print "There is an IPdressAd in the output string\n"; } else { print "There is no IPAddress in the output string"; }