jrvd has asked for the wisdom of the Perl Monks concerning the following question:
Hey monks!
I am trying to just get a regex to work but it doesn't do what I am looking for. I want to match anything that has 'neighbor' but not 'use neighbor'. Also, what is before 'use neighbor' varies so I can't really rely on that.
Here is my test code:
#!/usr/bin/perl use strict; use warnings; my $var = "use neighbor 2001:504:0:4::6181:1"; ($var =~/(?!use) neighbor[[:alpha:]-]* ([[:alnum:]\.-:]+)/) and do{ print $1; };
Any ideas would be greatly appreciated! Thanks and have a nice day!
jrvd
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Quick Regex trouble
by kennethk (Abbot) on Jul 16, 2013 at 20:47 UTC | |
by 2teez (Vicar) on Jul 16, 2013 at 21:16 UTC | |
by Laurent_R (Canon) on Jul 16, 2013 at 21:28 UTC | |
Re: Quick Regex trouble
by Not_a_Number (Prior) on Jul 16, 2013 at 21:47 UTC | |
Re: Quick Regex trouble
by choroba (Cardinal) on Jul 17, 2013 at 07:51 UTC | |
Re: Quick Regex trouble
by hdb (Monsignor) on Jul 17, 2013 at 07:22 UTC |
Back to
Seekers of Perl Wisdom