pattern matching in multi-line strings fails under perl4.034 
Author Message
 pattern matching in multi-line strings fails under perl4.034

Has anyone experienced any problems with pattern matching on
multi-line strings?  The same piece of code fails under perl4.034
but yet works under perl4.019.  Have I missed something documented
in the upgrade notes?

--curtis

Output using perl PL=19
=============================================================================================
nova[546]% /usr/local/bin/perl4.019 -d -e 0;

Loading DB routines from $RCSfile: perldb.pl,v $$Revision: 4.0.1.3 $$Date: 92/06/08 13:43:57 $
Emacs support available.

Enter h for help.

main'(/tmp/perl-ea17654:1):     0
  DB<1> $txt="Line1\nline2\nLine3\nHere is line 4\n"

  DB<2> p $txt
Line1
line2
Line3
Here is line 4

  DB<3> p "YES" if $txt =~ "^Here"
YES
  DB<4> q

Output using perl PL=34
=============================================================================================
nova[547]% /usr/local/bin/perl4.034 -d -e 0;

Loading DB routines from $RCSfile: perldb.pl,v $$Revision: 4.0.1.3 $$Date: 92/06/08 13:43:57 $
Emacs support available.

Enter h for help.

main'(/tmp/perl-ea17660:1):     0
  DB<1> $txt="Line1\nline2\nLine3\nHere is line 4\n"

  DB<2>  p $txt
syntax error in file (eval) at line 1, next 2 tokens "p $txt"

  DB<3> p $txt
Line1
line2
Line3
Here is line 4

  DB<4> p "YES" if $txt =~ "^Here"

  DB<5> q
--
---
Curtis C. Generous
NASA STI



Sun, 11 Dec 1994 02:07:32 GMT  
 pattern matching in multi-line strings fails under perl4.034

:Has anyone experienced any problems with pattern matching on
:multi-line strings?  The same piece of code fails under perl4.034
:but yet works under perl4.019.  Have I missed something documented
:in the upgrade notes?
:
:Output using perl PL=19
:nova[546]% /usr/local/bin/perl4.019 -d -e 0;
:
:  DB<1> $txt="Line1\nline2\nLine3\nHere is line 4\n"
:  DB<3> p "YES" if $txt =~ "^Here"
:YES
:
:Output using perl PL=34
:  DB<4> p "YES" if $txt =~ "^Here"
:  DB<5> q

The 4.034 behaviour is correct, and is the same as the 4.010
behaviour; I believe 4.019 was broken.

Here's the deal: ^ means beginning of string, not beginning of line UNLESS
you set $* true.  If you do this in your example, it then works on all
versions, and fits the spec as I understand it.

--tom
--

                "So much mail, so little time."  



Sun, 11 Dec 1994 08:34:23 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Pattern bug matching whitespace in multi-line match?

2. problems with chat2.pl and perl4.034 - RESOLVED

3. regex to match a multi line pattern

4. Multi line pattern matches?

5. Multi-line pattern matching?

6. regex to match a multi line pattern

7. Multi-line pattern matching

8. Multi line pattern match

9. Can't Match Multi-Line Pattern

10. Multiline pattern matching with command line invocation

11. Multi-line pattern matching in 5.001n

12. multiline, multi pattern match

 

 
Powered by phpBB® Forum Software