I Would like to extract the lines that between {"befor " 17}, {"androidID and "{"After ", 16}, {"37abc5afce16b6www03", 17}" on my file by using regular expression on python
I have text as follow:
[pid 3342] 12:13:44 pread64(6,"res/color/hint_foreground_material_light.xml", 44, 377177) = 44
[pid 3342] 12:13:44 mmap(NULL, 597, PROT_READ, MAP_SHARED, 6, 0x5c000) = 0x7f7754c000
[pid 3342] 12:13:44 munmap(0x7f7754c000, 597) = 0
[pid 3342] 12:13:44 *writev(4, [{" hZZ v;", 11}, {" ", 1}, {"befor " 17}, {"androidID ", 10}], 4) = 39*
[pid 3342] 12:13:44 getuid() = 11811
[pid 3342] 12:13:44 getuid() = 11811
[pid 3342] 12:13:44 ioctl(11, 0xc0306201, 0x7fc52d8fb0) = 0
[pid 3342] 12:13:44 ioctl(11, 0xc0306201, 0x7fc52d9180) = 0
[pid 3342] 12:13:44 writev(3, [{"l ", 7}, {"hZZ ;", 11}, {" ", 1}, {"After ", 16}, {"37abc5afce16b6www03", 17}], 5)= 52
[pid 3342] 12:13:44 getuid() = 11811
...
any suggestions?
Try this one r"(?m)^.*?\\{\\"befor[ ]\\"[ ]17\\},[ ]\\{\\"androidID.*[\\S\\s]+?^.*?\\{\\"After[ ]\\",[ ]16\\},[ ]\\{\\"37abc5afce16b6www03\\",[ ]17\\}.*"
https://regex101.com/r/fyPZpq/1
(?m)
^ .*? \{"befor [ ] " [ ] 17\}, [ ] \{"androidID .*
[\S\s]+?
^ .*? \{"After [ ] ", [ ] 16\}, [ ] \{"37abc5afce16b6www03", [ ] 17\} .*
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.