Thread Suchabfrage funktioniert nicht (Regex match) (5 answers)
Opened by samuelk at 2016-04-05 14:14

GwenDragon
 2016-04-05 14:39
#184372 #184372
User since
2005-01-17
14533 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
my $content_line_input = '<VT>!Z</VT>';
if ( $content_line_input =~ /<VT>!Z<\/VT>/gi ) {
        $content_line_input = "dasisteintest";
        print "testtest\n\n";
}


ergibt bei mir in der Shell:
~ perl a.pl
testtest

~


Also ist der Code ok.

Auch mit dem Debugger:


~ perl -d a.pl

Loading DB routines from perl5db.pl version 1.33
Editor support available.

Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(/home/test/a.pl:6):
6: my $content_line_input = '<VT>!Z</VT>';

DB<1> l 1-99
1 #!/usr/bin/perl
2
3: use strict;
4: use warnings;
5
6==> my $content_line_input = '<VT>!Z</VT>';
7: if ( $content_line_input =~ /<VT>!Z<\/VT>/i ) {
8: $content_line_input = "dasisteintest";
9: print "testtest\n\n";
10 }
DB<2> t
Trace = on
DB<2> n
main::(/home/test/a.pl:7):
7: if ( $content_line_input =~ /<VT>!Z<\/VT>/i ) {
DB<2> n
main::(/home/test/a.pl:8):
8: $content_line_input = "dasisteintest";
DB<2> n
main::(/home/test/a.pl:9):
9: print "testtest\n\n";
DB<2> n
testtest

Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<2>
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread Suchabfrage funktioniert nicht (Regex match)