Hi, Here is a regex I can't figure out. The intent is to catch all text from a line and its continuation if any (in msg headers). In the case here, it doesn't work. Anyone could explain ? Thanks.
#!/usr/local/bin/perl -w use strict; my $lgl = '\s*((?:.*?)\n(?:\s+.*?\n)*)'; my $a = "Head:\nSubject: some text\n and more\n and end\nTail:\n"; $a =~ /^Subject:$lgl/imo; print "--this is ok:\n$1"; my $b = "Head:\nSubject:\nTail:\n"; $b =~ /^Subject:$lgl/imo; print "--this is wrong:\n$1"; __END__ --this is ok: some text and more and end --this is wrong: Tail: