正则表达式翻译

发布于 2025-01-06 17:39:59 字数 61 浏览 2 评论 0原文

我需要将其翻译为正则表达式: 我需要找到大写单词,单词后面有空格,空格后面有一个“-”。谁能帮我翻译一下这个

i need to translate this in regex:
I need to find uppercase word,space after the word and a "-" after the white space. Can anybody help me with this translation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

难得心□动 2025-01-13 17:39:59

虽然不确定翻译是什么意思,但这可能就是您想要的:
/\b[AZ]+\b -/

取决于您对单词的定义。

或者,如果大写表示第一个字母大写,请使用 /\b[AZ][az]+\b -/

Though not sure what you mean by translate, this might be what you seek:
/\b[A-Z]+\b -/

Depends on your definition of word.

Or if uppercase means the first letter capitalized, use /\b[A-Z][a-z]+\b -/.

耶耶耶 2025-01-13 17:39:59

[AZ]+\s- 将符合我认为您需要的内容。 1 个或多个大写字母,后跟一个空格,后跟一个减号。取决于你对大写单词的意思,我假设它都是大写字母。

[A-Z]+\s- will match what I think you need. 1 or more uppercase letters, followed by a space followed by a minus sign. Depends on what you mean about uppercase word, I assume it's all uppercase letters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文