Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

推荐使用的正则表达式 #1

Closed
eric2788 opened this issue Dec 7, 2020 · 4 comments
Closed

推荐使用的正则表达式 #1

eric2788 opened this issue Dec 7, 2020 · 4 comments
Labels
补充 explanation

Comments

@eric2788
Copy link
Owner

eric2788 commented Dec 7, 2020

这是我目前使用的

^(?<n>[^]+?)?\:?\s*(?<cc>[^]+?)?$

有其他更好的可以在下方提出。

@eric2788 eric2788 added the 补充 explanation label Dec 7, 2020
@eric2788 eric2788 pinned this issue Dec 7, 2020
@seawolfers
Copy link

seawolfers commented Dec 22, 2020

有些同传用的冒号:和引号的
^(?<n>[^【】]+?)?\:*\s*[【 : " “](?<cc>[^【】]+?)[】: " ”]*$

@eric2788
Copy link
Owner Author

可捕捉括號

^(?<n>[^()]+?)?\:*\s*[(](?<cc>[^()]+?)[)]*$

@eric2788
Copy link
Owner Author

eric2788 commented Jan 19, 2021

可捕捉歌詞彈幕發送機的彈幕,可捕捉格式:

  • ❄【彈幕歌詞】❄
  • ♪【音樂歌詞】~
^(?<n>[^]+?)?\:?\s*(?<cc>[^]+?)(.?)?$

更新 22:15 - 1/19-2021: 修復會吞掉最後一個字的問題

@ssrkaze
Copy link

ssrkaze commented Jan 20, 2021

根据我的DD经验,直播间的文本大致可能出现:

  1. 太anti了
  2. 30【有了有了
  3. 【这个这个】
  4. 【原来如此
  5. 】真的有这种人吗
  6. 有在自己的满月直播里】
  7. ♪【歌词
  8. ♪【歌词】
  9. ♪【歌词】♪

除去第一个是普通弹幕之外,其他的都是可能的同传文本。
所以我的正则是:
^(?<n>[^【】]+?)?\:*\s*([【】]+?)(?<cc>[^【】]*)(】*)(.*)$

应该能把这些情况覆盖到。但是由于宽容度增加了,有可能出现意外的情况(虽然现在还没碰到)。

Repository owner locked and limited conversation to collaborators Mar 2, 2022
@eric2788 eric2788 converted this issue into discussion #21 Mar 2, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
补充 explanation
Projects
None yet
Development

No branches or pull requests

3 participants