Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: Multiline match

by LanX (Bishop)
on May 23, 2013 at 16:32 UTC ( #1034977=note: print w/replies, xml ) Need Help??

in reply to Re^2: Multiline match
in thread Multiline match

But your explanation was the other way round.

plz try to show us a reproducible code example instead of wording.

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: Multiline match
by arunbhargav (Novice) on May 23, 2013 at 16:33 UTC
    Sorry about the confusion, the following is the code I have been trying
    my $str = "update patch-"; my $patch = "patch-"; if ($str =~/$patch/ms) { print "Yes \n"; }
      thats the way it works

      DB<105> $str = "update\npatch-"; => "update\npatch-" DB<106> $patch = "patch-" => "patch-" DB<107> $str =~/\Q$patch/ => 1

      $patch must be included in $str not vice versa.

      No need for multiline because your pattern doesn't span multiple lines.

      '\Q' assures that regex syntax like '.' is escaped.

      Cheers Rolf

      ( addicted to the Perl Programming Language)

      Along the lines of your initial code:

      use strict; use warnings; my $PatchPath = "patch-"; my $output = "update patch-"; my @array = split /\s+/, $output; if ( grep { $PatchPath =~ /$_/ } @array ) { print "Match found\n"; }

      SORRY: This post is somehow to far up in the chain. Should be a few posts further down...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034977]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2018-02-24 22:18 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (311 votes). Check out past polls.