Find regex pattern

-1

Here is a string I am trying to find a match for:

Result: Parcel(
  0x00000000: 00000000 0000000f 00350033 00360030 '........3.5.0.6.'
  0x00000010: 00350039 00300032 00310030 00330032 '9.5.2.0.0.1.2.3.'
  0x00000020: 00350039 00000031                   '9.5.1...        ')

Result: Parcel(
  0x00000000: 00000000 0000000f 00350033 00360030 '........4.5.0.6.'
  0x00000010: 00350039 00300032 00310030 00330032 '9.9.2.0.0.6.2.3.'
  0x00000020: 00350039 00000031                   '9.5.2...        ')

The output should look like:

[350695200123951, 450699200623952]

This is an output from adb iphonesubinfo and what I need is the number inside the quotes combined as a single string. To be noted here that this is output of using & over two commands in the command prompt and there can be more than two. My initial attempt was first to parse the content inside the quotes which would be something like .. ......4.5.0.6. and later I was planning on stripping the periods(.). The search() function with above pattern does return the last value but match() or findall() did not. Output I get is None.. so basically it is not able to find a match.

pattern = r"'([A-Za-z0-9_\./\\-]*)'"
m = re.findall(pattern, pattrn, re.M| re.I)
pattern = r"'([A-Za-z0-9_\./\\-]*)'"
m = re.match(pattern, pattrn, re.M| re.I)

What am I missing?

python
regex
adb
asked on Stack Overflow Jul 24, 2020 by ask_me • edited Jul 24, 2020 by ask_me

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0