Skip to content

异步JS提取中的正则问题 #82

Description

@0berry

lib/Recoversplit.py 中的jsCodeCompile方法

jsCodeFunc 测试数据为如下时,进入两个正则匹配
function js_compile(e){js_url="static/js/"+e+"."+{"chunk-06983978":"b0d3c4a1","chunk-2d0c8bf7":"071bb4c1","chunk-2d0cfaef":"b3ae4a29","chunk-2d0d0f79":"608eaa0e","chunk-2d0e4b0c":"4d8239f4","chunk-2d0e4e1f":"a3ce6cee","chunk-2d0e944c":"f6b43059","chunk-2d2104c6":"f0215a5f","chunk-2d226cab":"084119b8","chunk-2d229205":"94d86195","chunk-3fa7be4f":"41b57439","chunk-94d3c3c4":"50d75ee9","chunk-9ea35268":"e3a3a06a"}[e]+".js"
return js_url}

pattern1 = re.compile(r"\{(.*?)\:")
pattern2 = re.compile(r"\,(.*?)\:")
nameList1 = pattern1.findall(jsCode)
nameList2 = pattern2.findall(jsCode)

第一个正则提取时结果为
>>> nameList1
['js_url="static/js/"+e+"."+{"chunk-06983978"']

预期结果应该是
>>> re.findall(r"\{\"(.*?)\"\:",s)
['chunk-06983978']

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions