in reply to Re^2: Script won't run
in thread Script wont run
... 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: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Script won't run
by cbtshare (Monk) on Nov 23, 2015 at 03:13 UTC | |
by Athanasius (Archbishop) on Nov 23, 2015 at 03:37 UTC | |
|
Re^4: Script won't run
by cbtshare (Monk) on Nov 23, 2015 at 19:13 UTC | |
by Athanasius (Archbishop) on Nov 25, 2015 at 08:15 UTC | |
|
Re^4: Script won't run
by cbtshare (Monk) on Nov 23, 2015 at 17:52 UTC |