Quote:
>I've been trying and trying, but I don't seem able to get this
>working...
You are fixated on the pattern and the pattern is not where
your problem is.
There are *two* things to consider when a pattern match is not
working as you expect it to: the pattern, and the string that
the pattern is to be matched against.
You have a problem with the string that is to be matched against.
Quote:
>I've got a source file, which looks like this:
>gk18neel; ;ZFR000003004;ZFR-T <QL><QL></KOPZFR/3/17>
>'Betizing om in Gryk' is in <QL>fleurich stik dat g?ns oandacht
>ferget<QL><QL><QL></TXTZFR/1/9><QL><QL><QL></TXTZFR/1/9><QL><QL>YCHTENBREGE
>well... After the </KOPZFR/3/17> ther is a line break, but the rest is
^^
Quote:
>one line.
No it isn't. The rest is on several lines. Did your posting software
break it for you? How helpful (not!).
Quote:
>I want the script to pick out the stuff between </KOPZFR/3/17> and the
>first </TXTZFR/1/9>,
>$_ = <SOURCE> ;
That reads a single line into $_.
Since one thing you want to match is on one line, and the other
thing is on another line, it will never match if you have only
a single line string to match against.
Quote:
>while ( m|</kopzfr/.+?>(.+?)</txtzfr/.+?>|is ) {
>print $1;
>}
>But it doesn't work.
^^^^^^^^^^^^^
What does "doesn't work" mean?
That is a worthless description of your observations of the
code's behavior.
What did you observe that leads you to believe that it isn't "working"?
Did it match when you were expecting it to not match?
Did it not match when you were expecting it to match?
Does it match things that you don't want to match?
Does it not match things that you do want to match?
Does it generate messages?
Does it dump core?
??
Quote:
>I played with it a bit (well, not a bit...) and I
>think it just doesn't see whatever is in the file as one string.
Pattern matches do not match against file contents, they match
against a string in memory. It is up to you to load the memory
from the file correctly.
Quote:
>Can somebody help me out?
The docs installed on your very own hard disk can help you out:
perldoc -q matching
"I'm having trouble matching over more than one line. What's wrong?"
--
Tad McClellan SGML consulting
Fort Worth, Texas