in reply to Re: Need RegEx assistance
in thread Need RegEx assistance

Thank you very much, but I'm having a rough time executing the code, I get the following error:
Unmatched [ before HERE mark in regex m/<[ << HERE ^ at line 10

Replies are listed 'Best First'.
Re: Re: Re: Need RegEx assistance
by Anonymous Monk on Jul 12, 2002 at 21:51 UTC
    Unmatched [ before HERE mark in regex m/<[ << HERE ^ at line 10
    Please cut and paste or 'd/l code', don't try to retype it. If you don't see the 'd/l code' link, reparent by clicking on the node title. You will see it.
    #m/<[ # ^ should be '/' m/\[ # ^
      This is the code compliments of jsprat
      #!C:\Perl\bin\perl -w use strict; #paragraph mode - see perlvar, input record separator $/ = ""; while(<DATA>) { my @lines = split /\n/, $_; my $file; $lines[0] =~ s/\[/\[$file / if ($file) = $lines[1] =~ /([^/]*)$'; print join ("\n", @lines), "\n\n"; } __DATA__ [get4] $uri=/LRA/RiskApplicationPage.aspx $method=GET [get5] $uri=/LRA/CSS/RiskManagement.css $method=GET
      I receive the following error:
      Unmatched [ before HERE mark in regex m/([ << HERE ^/ at C:\Perl\greg2 +.pl line 10.
      I'm using the following code compliments of jsprat:
      #!C:\Perl\bin\perl -w use strict; #paragraph mode - see perlvar, input record separator $/ = ""; while(<DATA>) { my @lines = split /\n/, $_; my $file; $lines[0] =~ s/\[/\[$file / if ($file) = $lines[1] =~ /([^/]*)$'; print join ("\n", @lines), "\n\n"; } __DATA__ [get4] $uri=/LRA/RiskApplicationPage.aspx $method=GET [get5] $uri=/LRA/CSS/RiskManagement.css $method=GET
      and I receive the following error:
      Unmatched ( before HERE mark in regex m/( << HERE \[^/ at C:\Perl\Test +.pl line 10.
Re: Re: Re: Need RegEx assistance
by jsprat (Curate) on Jul 12, 2002 at 22:42 UTC
    I somehow deleted a single quote in line 10 when I posted it - take a look at the update. Not a very clear error message, huh?

    BTW, I'd have /msg'ed you, but you aren't logged in ;-) Maybe you should create an account?

      Thanks jsprat, you were a great help, I always learn something new, Thanks again!