regex - Positionally matching substrings in Python -


How do you parse ['i386', 'x86_64'] like a string Can '- Foo 23-Bar-APP PPC -arch i386 -sirrut / -fno-strict-aliasing -fPIC' ?

  & gt; & Gt; & Gt; My_arch_parse_function ('- foo 23-bar -arch i386 -arch x86_64 -isysroot / -fno-strict-aliasing -fPIC') & gt; & Gt; & Gt; ['I386', 'x86_64']  

whether it can be done using regex, or just using modules such as pipercing, or manually dividing and repeating on the partition can be done?

Perception: -arch VAL is grouped together.

Rex: (? & Lt; = - arch) [^] +

  gt; & Gt; Again Efandol (R "(? & Lt; = - Arch) ([^] +)", R "'- Afu 23-Bar-PHP-PP-Arc i386 -Sisraot -Funo-Strict-Eliasing -FPIC') [ 'PPC', 'I 386']  

Unmatched free space

  & gt; & gt; Foo = re.compile (r) "(^? & Lt; = - arch) \ s [[^ \ s] +")> gt;> gt; [Repeat AFFOULD (FU, R) '' - AFU-23-Bar-PHP-arch ION [Str.strip ()) [[PPC ',' IOM6 ']  

PS for that string in the [66] serial -fno-strict-aliasing -fPIC' ') Is not x86_64 , and do you end up between - pp pp and -arch i386 You are trying to ?


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -