develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000406.010] Problem with conditional regexps and ^, $

Thread Next
From:
kvale
Date:
April 6, 2000 13:54
Subject:
[ID 20000406.010] Problem with conditional regexps and ^, $
Message ID:
200004062054.NAA15410@phy.ucsf.EDU
This is a bug report for perl from kvale@ivy.ucsf.edu,
generated with the help of perlbug 1.28 running under perl v5.6.0.

I have been playing with conditional regexps in perl 5.6.0 and noticed
the following strange behavior:

ivy 156% cat test2.pl
$c = "bob";
print "no anchors matches\n" if $c =~ /b(?(1)ob)/;
print "^ anchor matches\n" if $c =~ /^b(?(1)ob)/;
print "\$ anchor matches\n" if $c =~ /b(?(1)ob)$/;
print "^\$ anchor matches\n" if $c =~ /^b(?(1)ob)$/;

ivy 157% perl test2.pl
no anchors matches
^ anchor matches
$ anchor matches

The regexp C< b(?(1)ob) > should match the string C< "bob" > exactly,
so any combination of C< ^$ > anchors should match as well. The fully
anchored regexp C< ^b(?(1)ob)$ > does not match, however, but should.

        -Mark
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.6.0:

Configured by kvale at Thu Mar 23 11:46:38 PST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 ivy.ucsf.edu v4.0 878 alpha '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=define use64bitall=define uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O4', gccversion=
    cppflags='-std -ieee -D_INTRINSICS -I/usr/local/include -DLANGUAGE_C'
    ccflags ='-std -fprm d -ieee -D_INTRINSICS -I/usr/local/include -DLANGUAGE_C'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=8, ptrsize=8, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /var/shlib
    libs=-lgdbm -ldbm -ldb -lm -liconv
    libc=/usr/shlib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-rpath,/home/kvale/lib/perl5/5.6.0/alpha-dec_osf/CORE'
    cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -msym -std -s -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /home/kvale/lib/perl5/5.6.0/alpha-dec_osf
    /home/kvale/lib/perl5/5.6.0
    /home/kvale/lib/perl5/site_perl/5.6.0/alpha-dec_osf
    /home/kvale/lib/perl5/site_perl/5.6.0
    /home/kvale/lib/perl5/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/kvale
    LANG=
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/kvale/lib:/home/kvale/gnu/db/msql/lib:/home/kvale/gnu/postgres/lib:/usr/lib:/usr/lib/X11:/usr/local/lib:/usr/local/visix/galaxy/lib
    LOGDIR (unset)
    PATH=.:/home/kvale/bin:/home/kvale/gnu/xmgr/grace/bin:/home/kvale/tex/teTeX/bin:/home/kvale/math/neuron/nrn/bin:/usr/local/bin:/usr/bin:/bin:/usr/ucb:/usr/bin/X11:/usr/bin/mh:/usr/bin/mme:/usr/dt/bin:/usr/local/bin/mbone:/usr/local/bin/mtools:/usr/local/visix/galaxy/bin:/usr/local/games:/usr/local/java/bin:/usr/local/entropic-5.1/bin:/usr/local/rsi/idl_4/bin:/usr/local/uimx2.9/bin:/usr/local/xview/bin:/home/kvale/graphics/kho/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About