periapt has asked for the wisdom of the Perl Monks concerning the following question:
I need to strip off the first three bracketed expressions and retain everyting from [0122] on. I have tried many variations on this theme but I seem to be missing something[Microsoft][ODBC SQL Server Driver][SQL Server][0122]USAGE: InvokeStor +edProcedure [param1], [param2], [param3], [param3]
However, when I change the {1} to {2}, the match fails. I am expecting $1 = [Microsoft][ODBC SQL Server Driver], $2 = everyting else$errmsg =~ /^ # start at beginning of string ( # capture first group \[ # an opening square bracket \w+ # followed by one or more word charrs ] # followed by a closing square bracket ) # close first capture {1} # capture should be 1 time ( # begin second capture .+ # match anything else 1 or more times ) # close second capture /x; # which gives $1 = [Microsoft], $2 = everything else
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem parsing an error msg with regex
by gothic_mallard (Pilgrim) on Oct 07, 2004 at 14:16 UTC | |
by periapt (Hermit) on Oct 07, 2004 at 14:24 UTC | |
|
Re: Problem parsing an error msg with regex
by ikegami (Patriarch) on Oct 07, 2004 at 14:07 UTC | |
by periapt (Hermit) on Oct 07, 2004 at 14:19 UTC | |
|
Re: Problem parsing an error msg with regex
by Roger (Parson) on Oct 07, 2004 at 14:19 UTC | |
|
Re: Problem parsing an error msg with regex
by Roy Johnson (Monsignor) on Oct 07, 2004 at 15:08 UTC |