Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

# in regexp

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


nthiery at clipper

Aug 22, 1995, 10:25 AM

Post #1 of 3 (599 views)
Permalink
# in regexp

I think you already have this one, since I have seen some bug reports
name as "comment and regexp...", but I did not have the time to check
more, so well, sorry for the disturbance if it was one:

---- version:
> /usr/local/bin/perl -v

This is perl, version 5.001


Copyright 1987-1994, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.


---- my script bla:
#!/usr/local/bin/perl -w

$_="bla";

/(#bla)/x && print "coucou !\n"; ######## HERE ##########

---- bug:
fregate-~/public_html/test-zone>bla
/(#bla)/: unmatched () in regexp at bla line 5.

---- working variantes:
/(bla)/x ...
/(#bla)/ ...
/(\#bla)/x ...
it works also with an old version (5.000)
people had also the same problem with patchlevel 1m

that's all folks

Good luck !

Thanks for all !

Isil


tye at metronet

Aug 22, 1995, 1:17 PM

Post #2 of 3 (571 views)
Permalink
Re: # in regexp [In reply to]

Excerpts from the mail message of Nicolas Thiery:
) I think you already have this one, since I have seen some bug reports
) name as "comment and regexp...", but I did not have the time to check
) more, so well, sorry for the disturbance if it was one:

This is intentional.

From regcomp.c:
else if (*regparse == '#') {
while (*regparse && *regparse != '\n')
regparse++;
regparse++;
continue;

Originally only "(?#comment)" was used for comments in //x. That
was deemed ugly so "#comment\n" is also allowed now:

% perl -de 0
DB<1> $x='hello'
DB<2> p $x =~ /(el)#ignore this comment/x
el
DB<3> q

) ---- working variantes:
) /(\#bla)/x ...

And you already know one of the ways to match # in //x.

--
Tye McQueen tye [at] metronet || tye [at] doober
Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


merlyn at teleport

Aug 22, 1995, 2:03 PM

Post #3 of 3 (571 views)
Permalink
Re: # in regexp [In reply to]

>>>>> "Tye" == Tye McQueen <tye [at] metronet> writes:

Tye> This is intentional.

Tye> Originally only "(?#comment)" was used for comments in //x. That
Tye> was deemed ugly so "#comment\n" is also allowed now:

Wow. I must say, I missed this. Was this added while I was in court? :-)

Time to make another change to the slides... :-)

Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn [at] stonehenge> Snail: (Call) PGP-Key: (finger merlyn [at] ora)
Web: <A HREF="http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.