Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thank you for your guide,

I managed to create a self contained example that reproduces the problem.

Now, I ran your test and it works on both perl versions, as you said.

But running the regex inside Expect.pm fails.

So the bug is in the expect package?

chain.txt

###################################################################### +########\r\n# This system is a restricted access system. + #\r\n# If collected security information reveals po +ssible criminal activity that #\r\n# exceeds privileges, evidence of + such activity may be provided to the rele- #\r\n# vantauthorities fo +r further action. By continuing past this point, you #\r\n# expressly + consent to this security monitoring. #\r\n############# +#################################################################\r\n +\r\nhostname: ~#
test.pl
use strict; use Expect; my $re1 = '(([#%:>~\$\] ])(?!\2)){3,4}|([\w\-\.]*)\$ *$|(\w[@\/]\w|sft +p).*?[#%>~\$\]]|^[#%\$>\:]~] *$'; my $test; open($test,"<","chain.txt"); my $exp = Expect->exp_init($test); $exp->expect(1, [ $re1 => sub { my $exp = shift; print "Match before : ",$exp->before(),"\n"; print "Match : ",$exp->match(),"\n"; print "Match after : ",$exp->after(),"\n"; }] ); close $test;




hans@hans-desktop ~ perl -v This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-li +nux-gnu-thread-multi hans@hans-desktop ~ perl -MExpect -e 'print $Expect::VERSION ."\n";' 1.21 perl test.pl Match before : ####################################################### +#######################\r\n# This system is a restricted access syste +m. #\r\n# If collected security informa +tion reveals possible criminal activity that #\r\n# exceeds privileg +es, evidence of such activity may be provided to the rele- #\r\n# van +tauthorities for further action. By continuing past this point, you # +\r\n# expressly consent to this security monitoring. #\r +\n################################################################### +###########\r\n\r\nhostname Match : : ~# Match after :



[hans@fedora ~]$ perl -v This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-li +nux-thread-multi [hans@fedora ~]$ perl -MExpect -e 'print $Expect::VERSION ."\n";' 1.35 [hans@fedora ~]$ perl test.pl Match before : ####################################################### +#######################\r\n# This system is a restricted access syste +m. Match : # Match after : \r\n# If collected security information reveals possibl +e criminal activity that #\r\n# exceeds privileges, evidence of such + activity may be provided to the rele- #\r\n# vantauthorities for fur +ther action. By continuing past this point, you #\r\n# expressly cons +ent to this security monitoring. #\r\n################## +############################################################\r\n\r\nh +ostname: ~#

In reply to Re^2: Problem with regex is a bug? or my regex (updated) by hanspr
in thread Problem with regex is a bug? or my regex by hanspr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-05-20 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?