下面是我拥有的示例字符串。
143s: WHAT IS <span>THAT</span>? 144s: HEAR THAT? 152s: EVERYBODY, SHH. SHH. 156s: <span>STAY</span> UP THERE. 163s: [BOAT CREAKING] 165s: WHAT IS THAT? 167s: [SCREAMING] 191s: COME ON! 192s: OH, GOD! 193s: AAH! 249s: OK. WE'VE HAD SOME PROBLEMS 253s: AT THE FACILITY. 253s: WHAT WE'RE ATTEMPTING TO <span>ACHIEVE</span> 256s: HERE HAS <span>NEVER</span> BEEN DONE. 256s: WE'RE THIS CLOSE 259s: TO THE REACTIVATION 259s: OF A HUMAN BRAIN CELL. 260s: DOCTOR, THE 200 MILLION 264s: I'VE SUNK INTO THIS COMPANY 264s: IS DUE IN GREAT PART 266s: TO YOUR RESEARCH.
考虑 , string withns:
和 text, after is 作为单行。
例如259s: OF A HUMAN BRAIN CELL.
我需要正则表达式,它返回给我的行有,
Previous Line of Line having span tag if any + Line having span tag + Next Line of having span tag if any
所以上面的字符串应该返回我 3 个匹配项。
1st : 143s: WHAT IS <span>THAT</span>? 144s: HEAR THAT?
2nd : 152s: EVERYBODY, SHH. SHH. 156s: <span>STAY</span> UP THERE. 163s: [BOAT CREAKING]
3rd : 253s: WHAT WE'RE ATTEMPTING TO <span>ACHIEVE</span> 256s: HERE HAS <span>NEVER</span> BEEN DONE