regex - regular expression for a serial number -
i have long payload , need return serial number has many serial numbers , want return serial number after tag. here payload:
usb: usb 2.0 superspeed bus: host controller location: building internal card reader: product id: 0x8406 serial number: 000000000820 //i dont want building: yes usb 2.0 bus: pci id: 0x8c31 iphone: vendor id: 0x05ac (skyway inc.) version: 7.02 serial number: wea0aa752ada7722ac92575e98z2e89c691f4282 //i want speed: 492 mb/sec rec id: 0x11100000 / 1 skyway internal keyboard / trackpad: product id: 0x0162 recog id: 0x05ac (skyway inc.) location id: 0x14c00000 / 3 current available (ma): 500 built-in: yes
how can build regular expression return me following:
wea0aa752ada7722ac92575e98z2e89c691f4282
i tried doing following return expressions start serial number:
serial number: [0-9]
i want serial number shows after iphone title.
\\biphone:[\\s\\s]*?\\bserial number: (\\w+)
try , grab group 1.see demo.
https://regex101.com/r/hf7zz1/5
for (nstextcheckingresult *match in matches) { //nsrange matchrange = [match range]; nsrange matchrange = [match rangeatindex:1]; nsstring *matchstring = [htmlstring substringwithrange:matchrange]; nslog(@"%@", matchstring); }
Comments
Post a Comment