Regex, select closest match

后端 未结 3 597
迷失自我
迷失自我 2020-11-29 11:15

Assume the following word sequence

BLA text text text  text text text BLA text text text text LOOK text text text BLA text text BLA

What I

3条回答
  •  Happy的楠姐
    2020-11-29 12:12

    simply find text between LOOK and BLA without BLA

    In : re.search(r'BLA [^(BLA)]+ LOOK', 'BLA text text text  text text text BLA text text text text LOOK text text text BLA text text BLA').group()
    Out: 'BLA text text text text LOOK'
    

    :-)

提交回复
热议问题