#!/usr/local/bin/perl -w use strict; my $log="192.168.1.254 was around"; my $ip="192.168.1.254"; my @ip; push @ip,($log =~ /(^\Q$ip\E.*$)/); print @ip; __END__ 192.168.1.254 was around
Update: Added ^ anchor, poster wanted IP at start of string.
CU
Robartes-
In reply to Re: and a simple reg exp poser
by robartes
in thread and a simple reg exp poser
by stew
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |