On Nov 1, Michael Gargiullo said:

I'm in the process of writing a rather complex parser script to parse
nessus output, can be anything from:

results|192.168.1|192.168.1.131|https (443/tcp)|10330|Security Note|A
web server is running on this port through SSL\n

to

results|192.168.1|192.168.1.131|https (443/tcp)|10863|Security Note|Here
[snip]
accepts TLSv1 connections.\n\n

To make a long story short (to late), I have a mysql table with two
columns; start and end dynamic content.  "Start" marks the beginning of
data specific to this host, and "end", it's opposite.

             my $splito=$dynparsparts[0];
             my $splitt=$dynparsparts[1];
             my @parts=split(/$splito/,$problem);

The line above fails halfway through with the following error:

Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE
seems* to be / at ./import-nessus-scan.pl line 116.

This means $splito (the string you're using as a regex) is a malformed pattern. If you don't want $splito to be interpreted AS a regex, you need to quotemeta() it:

  my $splito = quotemeta($dynparsparts[0]);
  ...
  my @parts = split /$splito/, $problem;

or to keep $splito normal, you can just use \Q...\E in the regex:

  my $splito = $dynparsparts[0];
  ...
  my @parts = split /\Q$splito\E/, $problem;

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to