加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

正则表达式反编译器

发布时间:2020-12-14 06:06:27 所属栏目:百科 来源:网络整理
导读:我找到了这个正则表达式,想要了解它.是否有任何正则表达式反编译器将以下正则表达式转换为单词?这真的很复杂. $text =~ /(((w)W*(?{$^R.(0+( q{a}lt$3))})) {8}(?{print +pack"B8",$^Rand ""})) +/x; 解决方法 Using YAPE::Regex::Explain (不确定它是否
我找到了这个正则表达式,想要了解它.是否有任何正则表达式反编译器将以下正则表达式转换为单词?这真的很复杂.

$text =~ /(((w)W*(?{$^R.(0+( q{a}lt$3))})) {8}(?{print +pack"B8",$^Rand ""})) +/x;

解决方法

Using YAPE::Regex::Explain(不确定它是否好,但它是搜索的第一个结果):

use YAPE::Regex::Explain;
my $REx = qr/(((w)W*(?{$^R.(0+( q{a}lt$3))})) {8}(?{print +pack"B8",$^Rand ""})) +/x;
my $exp = YAPE::Regex::Explain->new($REx)->explain;
print $exp;

我的解释如下:

  (                        group and capture to 1 (1 or more times
                           (matching the most amount possible)):
----------------------------------------------------------------------
    (                        group and capture to 2 (8 times):
----------------------------------------------------------------------
      (                        group and capture to 3:
----------------------------------------------------------------------
        w                       word characters (a-z,A-Z,0-9,_)
----------------------------------------------------------------------
      )                        end of 3
----------------------------------------------------------------------
      W*                      non-word characters (all but a-z,_) (0 or more times (matching the
                               most amount possible))
----------------------------------------------------------------------
      (?{$^R.(0+(              run this block of Perl code
      q{a}lt$3))})
----------------------------------------------------------------------
    ){8}                     end of 2 (NOTE: because you are using a
                             quantifier on this capture,only the
                             LAST repetition of the captured pattern
                             will be stored in 2)
----------------------------------------------------------------------
    (?{print +pack"B8"       run this block of Perl code,$^Rand ""})
----------------------------------------------------------------------
  )+                       end of 1 (NOTE: because you are using a
                           quantifier on this capture,only the LAST
                           repetition of the captured pattern will be
                           stored in 1)

有2个Perl代码块,必须单独分析.

在第一个块中:

$^R . (0 + (q{a} lt $3))

这里,$^R is“评估最后一次成功(?{code})正则表达式断言的结果”,表达式(0(q {a} lt $3))如果第三次捕获在[bz]中则给出1,0除此以外.

在第二块:

print +pack "B8",$^R and ""

它将之前的评估结果解释为(big-endian) binary string,get the number,convert it to the corresponding character,最后将其打印出来.

正则表达式一起找到每8个字母数字字符,然后将[b-z]中的那些字符视为二进制数字1,否则为0.然后将这8个二进制数字解释为字符代码,并打印出该字符.

例如,匹配字符串时将打印字母“H”= 0b01001000

$test = 'OvERfLOW';

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读