Martijn Lievaart wrote:
> On Wed, 09 Jan 2008 12:06:35 -0800, wrote:
>
>> On Jan 9, 2:39 pm, Martijn Lievaart <m...@rtij.nl.invlalid> wrote:
>>> On Wed, 09 Jan 2008 11:00:18 -0800, ame...@iwc.net wrote:
>>>> I have the following expression in my Perl script:
>>>> if (/^"([^\,].+)"\,"$/)
>
> (snip)
>
>> I might add, the input file looks like this:
>>
>> "#ABC","
>> [
>> ","ABC Dispensing designs, manufactures and services dispensing systems
> (snip)
>
> Yes, that regex will match the first line.
>
> $ perl -e 'print "yes\n" if "\"#ABC\",\"" =~ /^"([^\,].+)"\,"$/'
> yes
>
> (Note extra backslashes in the input line because this is executed from
> the commandline)
>
> BTW, the backslashes before the commas are completely unneeded.
>
> $ perl -e 'print "yes\n" if "\"#ABC\",\"" =~ /^"([^,].+)","$/'
> yes
Actually, none of the backslashes are really needed:
perl -e 'print qq/yes\n/ if q/"#ABC","/ =~ /^"([^,].+)","$/'
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall