douao1926 2015-11-22 11:22 采纳率: 0%
浏览 98

如何从正则表达式生成字符串数组?

Few days ago, I posted the same question on Python. Then, just curious, how can I do the same thing on Go?


I'm making a crawler. I'm wanting to take a user's given regex as an input and generate a list of strings to download data.

User's regex sample is:

http://xxx/abc[x-z]/image(9|10|11)\.png

I want to download these.

http://xxx/abcx/image9.png
http://xxx/abcy/image9.png
http://xxx/abcz/image9.png
http://xxx/abcx/image10.png
http://xxx/abcy/image10.png
http://xxx/abcz/image10.png
http://xxx/abcx/image11.png
http://xxx/abcy/image11.png
http://xxx/abcz/image11.png

Can I generate the array from regex strings? Or, can I use each string in for block?

python - Can I create list from regular expressions? - Stack Overflow Can I create list from regular expressions?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料