hanspr has asked for the wisdom of the Perl Monks concerning the following question:
Hi , dear monks
I'm using expect to detect login sequences, and I'm facing this un-explicable behaviour of my regex
This is the regex
And the text it fails against is shown below.
This regex runs correctly in Perl 5.30
And it fails in Perl 5.34
It works as expected in testing websites as : https://regex101.com/
I expected to match this sequence --> : ~#
But instead is matching --> \s\s#
as seen in the "Match string message below"
Match string: ` #'
I would like to confirm with your wisdom before opening bug request.
I'm using expect to detect login sequences, and I'm facing this un-explicable behaviour of my regex
This is the regex
(([#%:>~\$\] ])(?!\2)){3,4}|([\w\-\.]*)\$ *$|(\w[@\/]\w|sftp).*?[#%>~\ +$\]]|^[#%\$>\:]~] *$
And the text it fails against is shown below.
This regex runs correctly in Perl 5.30
And it fails in Perl 5.34
It works as expected in testing websites as : https://regex101.com/
I expected to match this sequence --> : ~#
But instead is matching --> \s\s#
as seen in the "Match string message below"
Match string: ` #'
I would like to confirm with your wisdom before opening bug request.
###################################################################### +######## # This system is a restricted access system. + # # If collected security information reveals possible criminal activity + that # # exceeds privileges, evidence of such activity may be provided to the + rele- # # vant authorities for further action. By continuing past this point, +you # # expressly consent to this security monitoring. + # ###################################################################### +######## hostname: ~# spawn id(5): Does `################################################### +###########################\r\n# This system is a restricted access s +ystem. #\r\n# If collected security i +nformation reveals possible criminal activity that #\r\n# exceeds pr +ivileges, evidence of such activity may be provided to the rele- #\r\ +n# vant authorities for further action. By continuing past this point +, you #\r\n# expressly consent to this security monitoring. + #\r\n########################################## +####################################\r\n\r\nhostname: ~# ' match: pattern #2: -eof `'? No. pattern #3: -re `\\[__PAC__SUDO__PROMPT__\\]'? No. pattern #4: -re `^.+ontinue connecting \\(([^/]+)\\/([^/]+)(?:[^)]+) +?\\)\\?\\s*$'? No. pattern #5: -re `.*(any key to continue|tecla para continuar).*'? No +. pattern #6: -re `.*ffending .*key in (.+?)\\:(\\d+).*'? No. pattern #7: -re `([lL]ogin|[uU]suario|([uU]ser-?)*[nN]ame.*|[uU]ser) +\\s*:\\s*$'? No. pattern #8: -re `([pP]ass|[pP]ass[wW]or[dt](\\s+for\\s+|\\w+@[\\w\\- +\\.]+)*|[cC]ontrase.a|Enter passphrase for key \'.+\')\\s*:\\s*$'? No +. pattern #9: -re `(([#%:>~\\$\\] ])(?!\\2)){3,4}|([\\w\\-\\.]*)\\$ *$ +|\\w[@\\/]\\w.*?[#%>~\\$\\]]|^[#%\\$>\\:]~] *$'? YES!! Before match string: `############################################ +##################################\r\n# This system is a restricted a +ccess system. ' Match string: ` #' After match string: `\r\n# If collected security information revea +ls possible criminal activity that #\r\n# exceeds privileges, eviden +ce of such activity may be provided to the rele- #\r\n# vant authorit +ies for further action. By continuing past this point, you #\r\n# +expressly consent to this security monitoring. + #\r\n########################################################## +####################\r\n\r\n\r\nhostname: ~# ' Matchlist: (`#', `#', `') Calling hook CODE(0x55f2fb33fe20)...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problem with regex is a bug? or my regex (updated)
by haukex (Archbishop) on Nov 20, 2021 at 08:59 UTC | |
by hanspr (Sexton) on Nov 20, 2021 at 14:31 UTC | |
by haukex (Archbishop) on Nov 20, 2021 at 14:45 UTC | |
by hanspr (Sexton) on Nov 20, 2021 at 15:05 UTC | |
by haukex (Archbishop) on Nov 20, 2021 at 15:47 UTC | |
| |
by duelafn (Parson) on Nov 20, 2021 at 15:01 UTC | |
Re: Problem with regex is a bug? or my regex
by dave_the_m (Monsignor) on Nov 20, 2021 at 08:21 UTC |
Back to
Seekers of Perl Wisdom