Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 May 2004 19:17:37 -0400
From:      "JJB" <Barbish3@adelphia.net>
To:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Perl metacharacters
Message-ID:  <MIEPLLIBMLEEABPDBIEGAELEFPAA.Barbish3@adelphia.net>

next in thread | raw e-mail | index | archive | help
I have problems with 2 different if statements that use
metacharacters.

if (/(abuse\@.* )/)
 {
  $abuse_email = ${1};
 }

The data line it's reading looks like this,

    remarks:  Please report all problems to abuse@xxxxx.xxx for
probes, port scans etc.

print($abuse_email) shows that it contains

abuse@xxxxx.xxx for probes, port scans etc.

The xxxxx.xxx can be any size, and any characters

How do I change the if statement so I only get the abuse@xxxxx.xxx
string?



Problem 2.

If (/(Net-.??-.??-.??-0-1)/)
 {
  $net_block = ${1};
 }


The data is (Net-xxx-xxx-xxx-0-1)
Each xxx group will all ways by 1 to 3 digits long and different
combinations every time.

When matched I want $net_block just to hold  Net-xxx-xxx-xxx-0-1

What is the correct syntax?

Thanks




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MIEPLLIBMLEEABPDBIEGAELEFPAA.Barbish3>