regex - Getting python regexp for data -
I have tried to find Python Regular Expressions to match the following lines, and to remove the part of each line My interest "|" Between "and". " (Upx predecessor) was my attempt:
pattern = compile.re (again "^ \ S + \ | (\ S +). Upx. +")
but it did not work
My data:
UMM_189 | XXYT9888_UMX_5711769.upx_OWED_786_bopsio_34527_sen_72.345615 AMW_126 | 7010.upx_XAWA01266525261 QEA_234 | Serami_bolismun_milte_1_UMM1.upx_YU_168145 MMP_377 | 723C_UMM_5711781.upx_UXA_2_serax_78120_ser_23.26255277
My expected output:
XXYT 9 888_UMX_5711769 7010 Serami_bolismun_milte_1_UMM1 723C_UMM_5711781
No better idea please?
I do not think Regex is required here because your data is pretty ordered and will be enough :
& gt; & Gt; & Gt; Data = '' '\ ... UMM_189 | XXYT9888_UMX_5711769.upx_OWED_786_bopsio_34527_sen_72.345615 ... AMW_126 | 7010.upx_XAWA01266525261 ... QEA_234 | Serami_bolismun_milte_1_UMM1.upx_YU_168145 ... MMP_377 | 723C_UMM_5711781.upx_UXA_2_serax_78120_ser_23.26255277 ... '' '& gt; & Gt; & Gt; [X.split ('|', 1) [1] .split ('. Upx', 1) [0] data in X. splitlines ()] ['XXYT9888_UMX_5711769', '7010', 'Serami_bolismun_milte_1_UMM1', '723C_UMM_5711781 '] & Gt; & Gt; & Gt;
Comments
Post a Comment