in reply to Re: Test RegEx
in thread Test RegEx

I have counted, added, subtracted ")" with no change in the error. I am trying to test the RegEx: ^\s*password\s+requisite\s+(/lib/security/$ISA/)?pam_cracklib.*lcredit=(0123456789-+

Replies are listed 'Best First'.
Re^3: Test RegEx
by Corion (Patriarch) on Apr 08, 2010 at 18:16 UTC

    You can't (try to) use / as the regex delimiter and (an unquoted) / within the regular expression. Use a different regex delimiter, for example !:

    ... if (@RECORD = grep (m!^\s*password\s+requisite\s+(/lib/security/$ISA/) +?pam_cracklib.*lcredit=([0123456789-]+!, @fRecords )) { ...

    Also see perlop on m//

      Error resolved, thanx. Now I just need to get on top of RegEx's
        One thing that might help, depending on which version of perl you are using, is the 'qr' operator. It works similar to qq or qw, except it works on regular expressions, which is very handy for using RegExs as variables passed in from a function or main arg.

        Hope that helps.
      Thanx, that's likely the problem. I'll try to work throgh with that.