natxo has asked for the wisdom of the Perl Monks concerning the following question:
Anyway, I created a hash (incomplete, but just to get the idea) with the translations to normal language: So I want to match the key to the error, and I came up with this, but it never matches:00000056: AtrErr: DSID-03190F80, #1: 0: 00000056: DSID-03190F80, problem 1005 (CONSTRAINT_ATT_TYPE), da +ta 0, Att 9005a (unicodePwd)
Edit: I updated the question with a piece of code. The $error comes from the actual error method in Net::LDAP and if I add [] to print it it actually looks like this:
with the last ']' as only character in the line.[00000056: AtrErr: DSID-03190F80, #1: 0: 00000056: DSID-03190F80, problem 1005 (CONSTRAINT_ATT_TYPE), da +ta 0, Att 9005a (unicodePwd) ]
But it is obviously not working. What is wrong with my crappy regular expression? :-) Thanks in advance$error = "00000056: AtrErr: DSID-03190F80, #1: 0: 00000056: DSID-03190F80, problem 1005 (CONSTRAINT_ATT_TYPE), da +ta 0, Att 9005a (unicodePwd) "; my %pwd_reset_errors = ( '0000052D' => "new password does not meet complexity requirements" +, '00000056' => "wrong old password", ); while ( my ( $key, $value ) = each %pwd_reset_errors ) { if ( $key =~ m/^$error.*/ ) { app->log->debug("$value"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex match multiple line
by ww (Archbishop) on Nov 26, 2014 at 22:06 UTC | |
by natxo (Scribe) on Nov 26, 2014 at 22:48 UTC | |
by graff (Chancellor) on Nov 27, 2014 at 01:22 UTC | |
by natxo (Scribe) on Nov 27, 2014 at 07:52 UTC | |
by james28909 (Deacon) on Nov 27, 2014 at 01:48 UTC | |
|
Re: regex match multiple line (updated question)
by Laurent_R (Canon) on Nov 27, 2014 at 07:19 UTC | |
|
Re: regex match multiple line (updated question)
by wazat (Monk) on Nov 27, 2014 at 18:15 UTC |