in reply to Re: strip text from a string
in thread strip text from a string

Hi,

Thanks for that, it's put me on the correct track, however when I run it inside a perl script using Starwberry Perl

#!/usr/bin/perl #use strict; use warnings; $str = "select Assigned, null, null, count(*) from wftask where Assign +ed in ('15000847','20005966','20005965','20004711','15120173','150004 +37','15023846','15022744','15062553','15149541','15000245','15000217' +,'15000803','15000636','15000690','15000437','15001069','15119338','1 +5022744','20009455','20001463','15179195','20008500','20004675','1500 +0988','15179195','15119270') and RefClass is not null and RefKey is n +ot null group by Assigned union select null, null, DistGroup, count(* +) from wftask where DistGroup in ('SLT','Budget Signatory/310','Budge +t Signatory/544','Budget Signatory/539','Budget Signatory/518','Budge +t Signatory/321','Budget Signatory/543','Budget Signatory/338','Budge +t Signatory/513','Budget Signatory/6','Budget Signatory/359','Budget +Signatory/358','Budget Signatory/530','Budget Signatory/300','Budget +Signatory/550','Budget Signatory/490','Budget Signatory/491','Budget +Signatory/376','Budget Signatory/377','Budget Signatory/401','Budget +Signatory/178','Budget Signatory/18','Budget Signatory/236','Budget S +ignatory/40','Budget Signatory/246','Budget Signatory/507','Budget Si +gnatory/475','Budget Signatory/464','Budget Signatory/459','Budget Si +gnatory/18','Budget Signatory/310','Budget Signatory/544','Budget Sig +natory/539','Budget Signatory/518','Budget Signatory/321','Budget Sig +natory/543','Budget Signatory/338','Budget Signatory/513','Budget Sig +natory/6','Budget Signatory/359','Budget Signatory/358','Budget Signa +tory/530','Budget Signatory/300','Budget Signatory/550','Budget Signa +tory/490','Budget Signatory/491','Budget Signatory/376','Budget Signa +tory/377','Budget Signatory/401','Budget Signatory/178','Budget Signa +tory/18','Budget Signatory/236','Budget Signatory/40','Budget Signato +ry/246','Budget Signatory/507','Budget Signatory/475','Budget Signato +ry/464','Budget Signatory/459','North Long Term Allocation','North Lo +ng Term Approvals','North Long Term Review','North Long Term Safeguar +ding','Placement Review','RAS Surgery','SLT Awaiting Allocation','SLT + Duty','SLT Duty Senior','SLT OT Equipment','SLT Pending','SLT Review +','SLT Single Service Reviews','KT26099','Budget Signatory/18') and R +efClass is not null and RefKey is not null group by DistGroup union s +elect null, DistDept, null, count(*) from wftask where DistDept in (' +D3347') and RefClass is not null and RefKey is not null group by Dist +Dept"; $str =~ s/(\s*'[^']*+?')//g; print $str
I get the message Nested quantifiers in regex; marked by <-- HERE in m/(\s*'^'*+? <-- HERE ')/ at C:\Perl\Perl_tests\SQLTest.pl line 6.

When I run it on the command line it works fine. As I have said in a another reply, I only started to use perl on Monday please excuse my ignorance.

Thanks

Replies are listed 'Best First'.
Re^3: strip text from a string
by AnomalousMonk (Archbishop) on Sep 11, 2014 at 15:36 UTC
    Nested quantifiers in regex; marked by <-- HERE in m/(\s*'^'*+? <-- HERE ')/ at ...

    The quantifier sequence  *+? is not valid and is termed 'nested'. See johngg's reply.

    Update: See also Quantifiers in perlre. See in particular the paragraph beginning "Note that the possessive quantifier modifier can not be be [sic] combined with the non-greedy modifier."

      Darn it! Thanks much for the correction; I missed the regex used.

Re^3: strip text from a string
by Anonymous Monk on Sep 11, 2014 at 15:30 UTC
    ,p>I did not care to read the whole SQL statement. Most likely there may be character(s) in the query that are significant (meta characters) for correct regex. So try to escape the string either via quotemeta or \Q & \E.