Python regular expression questions.

Asked 2 years ago, Updated 2 years ago, 46 views

  “I don't absolute humiliation for three consecutive losses” ...Japan puts minamino ‘grind one's teeth.’.
& 2014 u - a once a goal and a 19th championship. 
Reclaimed his game & usaempeuteonseo < e (the 153 _ p bi) ace > e and < >. 
In the run-up to the other day and a football to be held on July 25, go to convene and nine overseas players of training camp and Japan and hope to avenge. <e>손흥민(bi_P_60)</e>(<e>토트넘(bi_O_748)</e>)과 <e>황의조(bi_P_843)</e>(<e>보르도(bi_L_447)</e>), <e>황희찬(bi_P_108)</e>(<e>라이프치히(bi_L_216)</e>) 등 유럽파 정예멤버가 빠진 <e>한국(bi_L_117)</e>과 달리 일본은 해외파 9명을 소집해 지난 22일 합숙 훈련에 들어갔다.The Japanese sports media ‘seuponichia with Nex’ on October 23 “For the first time since November 2019, European and gungnaepa < e (the 155 _ l bi) Yokohama > e and < > in camp went on” and “this whole thing, < e >, (the 269 _ o bi) and < e in 1993, when they lost the > < e > j League (the 336 _ e bi) / e < amaechi third consecutive title will eat humble pie of the first since the inception of the >”, reported. Japan is in December 2017 < e > the East Asian Cup (the 111 _ e bi) / e < > e - 1 - 1-4 defeat in 2019 competitions in December after 0 - 1 and < e > the South Korean (bi l _ 117) and < e > two games to none.Japan has the great expectations for a player is ‘< e (the 153 _ p bi) ace > e and < >’ < e > minamino Takumi (the 209 _ p bi) / e < > of (26 and photographs). <e>잉글랜드 프리미어리그(bi_E_19)</e>(EPL) <e>리버풀(bi_O_2353)</e>에서 좀처럼 출장 기회를 잡지 못하다가 지난달 사우샘프턴으로 임대된 미나미노는 지난달 20일 <e>첼시(bi_L_417593)</e>전에서 골을 넣는 등 이후 최근 <e>리그(bi_P_1247)</e> 6경기에서 2골을 터뜨렸다. Scheduled for the last 20 days, is minamino < e > fakeop (the 272 _ e bi) and < e > the quarterfinals in the game against Bournemouth the fastest in the middle of the Europe without a business trip entered 21, in tuned.Sponichi do it seven years ago, scored multiple goals to the other day and a victory is minamino. The media is " minamino < in the amaechi e > the South Korean (bi l _ 117) and < e > and first met, but < e > the South Korean (bi l _ 117) and < e > the uncomfortable, there is no sense. 2014 - 19 Championship first round League < u e > the South Korean (bi l _ 117) and < e > to victory with two goals in tournament appearances led Japan to the first place, said. At that time, < e > the South Korean (bi l _ 117) and < e > is < e > gimgeonhui (bi p _ 1038) / e < > is two goals knocked over 1 - lost to one goal, but minamino.Japan is one, to participate in the elite are the other day. <e>Maya Yoshida (bi_P_6770)</e> (33·<e> Sampdoria (bi_O_942)</e>) and Takehiro Tomiyasa (23·<e> Bologna (bi_L_2014)&e>, Germany's main defender, Seir>10> and etc. Japan's national team defender <e>Sasaki Sho (bi_P_364) </e> (32, <e> Sanfrecce Hiroshima (im_OG_1190) </e>) is a game that (Korea-Japan match) plays with a different mindset than usual in an interview with "Soccer Magazine Web." He said, "I'm determined to win even if I'm <e> I'm (iim_RD_2274)</e> I want to win."

I want to extract only Berther Bremen (im_O_933) between <e> and </e> from the above string. I'm going to split everything in space and try it with ^<e> and search the regular expression, but it's so hard that I'm going to ask for the help of masters

python regex

2022-09-20 15:13

2 Answers

  > > > s ''' : "I don't absolute humiliation for three consecutive losses" ….Japan puts minamino ‘grind one's teeth.’.
& 2014 u - a once a goal and a 19th championship. ...
Reclaimed his game. & usaempeuteonseo < e (the 153 _ p bi) ace > e and < >.
And soccer, which will be held on July 25, go to convene ... & nine overseas training camp ahead of the other day has hope to avenge Japan. <e>손흥민(bi_P_60)</e>(<e>토트넘(bi_O_748)</e>)과 <e>황의조(bi_P_843)</e>(<e>보르도(bi_L_447)</e>), <e>황희찬(bi_P_108)</e>(<e>라이프치히(bi_L_216)</e>) 등 유럽파 정예멤버가 빠진 <e>한국(bi_L_117)</e>과 달리 일본은 해외파 9명을 소집해 지난 22일 합숙 훈련에 들어갔다.Japanese sports media ‘seuponichia with Nex’ is 23, "For the first time since November 2019, European and gungnaepa < e > e and Yokohama (155) < l _ _ bi > in went on camp" and "this whole thing, < e e and KEPCO (269) < o _ _ bi > < in 1993, lost in the > e > j League (bi e _ e and 336) < > of three consecutive losses after the inauguration of the first amaechi to eat humble pie.", reported. Japan is in December 2017 < e > the East Asian Cup (the 111 _ e bi) / e < > e - 1 - 1-4 defeat in 2019 competitions in December after 0 - 1 and < e > the South Korean (bi l _ 117) and < e > two games to none.Japan has the great expectations for a player is ‘< e (the 153 _ p bi) ace > e and < >’ < e > minamino Takumi (the 209 _ p bi) / e < > of (26 and photographs). <e>잉글랜드 프리미어리그(bi_E_19)</e>(EPL) <e>리버풀(bi_O_2353)</e>에서 좀처럼 출장 기회를 잡지 못하다가 지난달 사우샘프턴으로 임대된 미나미노는 지난달 20일 <e>첼시(bi_L_417593)</e> 전에서 골을 넣는 등 이후 최근 <e>리그(bi_P_1247)</e> 6경기에서 2골을 터뜨렸다. Scheduled for the last 20 days, is minamino < e > fakeop (the 272 _ e bi) and < e > the quarterfinals in the game against Bournemouth the fastest in the middle of the Europe without a business trip entered 21, in tuned.Sponichi do it seven years ago, scored multiple goals to the other day and a victory is minamino. The media is " minamino < in the amaechi e > the South Korean (bi l _ 117) and < e > and first met, but < e > the South Korean (bi l _ 117) and < e > the uncomfortable, there is no sense. 2014 - 19 Championship first round League < u e > the South Korean (bi l _ 117) and < e > to victory with two goals in tournament appearances led Japan to the first place, said. At that time, < e > the South Korean (bi l _ 117) and < e > is < e > gimgeonhui (bi p _ 1038) / e < > is two goals knocked over 1 - lost to one goal, but minamino.Japan is one, to participate in the elite are the other day. <e>요시다 마야(bi_P_6770)</e>(33·<e>삼프도리아(bi_O_942)</e>)와 도미야사 다케히로(23·<e>볼로냐(bi_L_2014)</e>) 등 <e>이탈리아 세리에A(bi_E_106)</e> 소속 수비수가 가세했고, 공격 라인에는 독일 슈투트가르트의 주전 미드필더 <e>엔도 와타루(bi_P_2097)</e>(28), <e>오사코 유야(bim_P_6131)</e>(31·<e>베르더 브레멘(im_O_933)</e>)가 포진한다. The Japanese national team defender < e > (the 364 _ p bi) Sasaki show and < e > (32 and < e >, Sanfrecce Hiroshima (im og _ 1190) / e < >) ‘soccer related magazines and Web’ said in an interview (The other day and a) and inviting other good start with the same mind as usual. I'm determined, tight. "and" < e > is (iim rd _ 2274) and < e, '' said Incerti. I want to win at >'''

>>> re.findall("<e>(.*?)<\/e>",s)
['에이스(bi_P_153)', '손흥민(bi_P_60)', '토트넘(bi_O_748)', '황의조(bi_P_843)', '보르도(bi_L_447)', '황희찬(bi_P_108)', '라이프치히(bi_L_216)', '한국(bi_L_117)', '요코하마(bi_L_155)', '한전(bi_O_269)', 'J리그(bi_E_336)', '동아시아컵(bi_E_111)', '한국(bi_L_117)', '에이스(bi_P_153)', '미나미노 다쿠미(bi_P_209)', '잉글랜드 프리미어리그(bi_E_19)', '리버풀(bi_O_2353)', '첼시(bi_L_417593)', '리그(bi_P_1247)', 'FA컵(bi_E_272) ',' Korean (bi l _ 117) ',' (bi l _ 117) ',' the Korean (bi l _ 117) ',' (bi l _ 117) ',' gimgeonhui (bi p _ 1038) ',' Maya Yoshida (bi p _ 6770) ',' Sampdoria (bi o _ 942) ',' (bi The _ _ l) ',' in Bologna, Italy, Serie a (the 106 _ e bi) ',' Endo Wataru     ',' osako Yuya     ',' Werder Bremen     ',' Sasaki     the show ',' Sanfrecce Hiroshima     is ','     ].


2022-09-20 15:13

Other masters would tell me a better way, but... Let me write down my thoughts first.

text = '<e> Osaka Yuya (bim_P_6131)</e> (31·<e> Werder Bremen (im_O_933</e>)'
#print(text.count('<e>'))
while 1:
    #print(text.count('<e>'))
    #print(text)
    for i in range(len(text)):
        #print(text[i:i+3])
        if text[i:i+3] == '<e>':
            r = text.split(text[i:i+3])[1].split('</e>')[0]
            print(r)
            #print(text.split('</e>')[0])
            text = text.split(r + '</e>')[1]
            #print(text)
            break
    if text.count('<e>') < 1:
        break

I think this is enough to use right away.


2022-09-20 15:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.