我需要帮助为Python创建一个正则表达式

时间:2018-01-13 23:25:21

标签: python regex variables

我需要一个正则表达式来专门捕获 _0x263E9 [数字]

我不想替换其他任何东西,有没有人知道解决这个问题的最佳方法。我使用regex101寻求帮助,但我似乎无法做到这一点

''' _0x264A5(_0x26503) 
    0x26503(_0x263E9[37])[_0x263E9[36]](_0x263E9[12], function () {
        var _0x265BF = _0x263E9[13],
            _0x26561 = _0x263E9[14],
            _0x26795 = window[_0x263E9[15]];
        if (new RegExp(_0x263E9[17])[_0x263E9[16]](_0x26795)) {
            for (var _0x2667B = document[_0x263E9[19]](_0x263E9[18]), _0x266D9 = 0; _0x266D9 < _0x2667B[_0x263E9[5]]; _0x266D9++) {
                if (_0x2667B[_0x266D9][_0x263E9[20]][_0x263E9[5]] > 0) {
                    var _0x2661D = _0x2667B[_0x266D9][_0x263E9[21]];
                    _0x263E9[13] == _0x2661D && (_0x2661D = _0x266D9), _0x265BF += _0x2661D + _0x263E9[3] + _0x2667B[_0x266D9][_0x263E9[20]] + _0x263E9[22]'''

1 个答案:

答案 0 :(得分:0)

感谢@cᴏʟᴅsᴘᴇᴇᴅ,你已经明白了。

尝试re.findall:返回群组列表。

用于捕获_0x263E9 [数字]的正则表达式:

re.findall(r'_0x263E9\[\d+\]', str)

或仅检索数字

re.findall(r'_0x263E9\[\(d+)\]', str)