... can you please tell me what the following means from your code.
?:\s+|$) /mgx
also
Q$password\E}
This should be (?:\s+|$) (a non-capturing grouping),
and s{Password=\Q$password\E}{...} (the match regex of a substitution).
To explain these:
Remember that \Q...\E metaquotes any non-\w character literal or interpolated character. See the \Q \L \l \U \u \E interpolation control escape sequences in Quote and Quote-like Operators in perlop; see also quotemeta.c:\@Work\Perl\monks>perl -wMstrict -le "use YAPE::Regex::Explain; ;; print YAPE::Regex::Explain->new('(?:\s+|$)')->explain; ;; my $password = 'f+o*o?[ ]b{}r'; my $regex = qr/Password=\Q$password\E/; print YAPE::Regex::Explain->new($regex)->explain; " The regular expression: (?-imsx:(?:\s+|$)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- The regular expression: (?-imsx:Password=f\+o\*o\?\[\ \]b\{\}r) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- Password=f 'Password=f' ---------------------------------------------------------------------- \+ '+' ---------------------------------------------------------------------- o 'o' ---------------------------------------------------------------------- \* '*' ---------------------------------------------------------------------- o 'o' ---------------------------------------------------------------------- \? '?' ---------------------------------------------------------------------- \[ '[' ---------------------------------------------------------------------- \ ' ' ---------------------------------------------------------------------- \] ']' ---------------------------------------------------------------------- b 'b' ---------------------------------------------------------------------- \{ '{' ---------------------------------------------------------------------- \} '}' ---------------------------------------------------------------------- r 'r' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Script won't run
by AnomalousMonk
in thread Script wont run
by cbtshare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |