如何在TCL中使用proc编写正则表达式来处理以下模式?
我是 TCL 新手,寻求帮助来处理以下表达式。 我从用户那里获取 i/p 字符串来验证下面的任何字符串 & CLI 使用过程中的一行中没有其他字符
{ GHI GII GJI GKI}
,另一个棘手的问题是编写正则表达式以仅匹配以字母 A & 开头的字符。以 B 结尾,在使用过程之间还有 1 个或多个 YO 或 OY。 谢谢
I am new to TCL and seeking a help to deal with the following expression.
I am getting the i/p string from the user to validate any of these strings below & no others in a line in CLI using procedure
{ GHI GII GJI GKI}
and another tricky one is to write regexp to match only the characters which begin with alphabet A & end with B, It also have 1 or more of either YO or OY in between using procedure.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是您的输入,那么实际上不需要使用正则表达式:只需检查提供的单词是否在该列表中:
匹配“以字母 A 开头并以 B 结尾,它还有 1 个或多个 YO或 OY 之间”:
如果您的意思是“(1 个或多个 YO)或(1 个或多个 OY),则正则表达式为
If that's your input, then really there's no need to use regular expressions: just check that a supplied word is in that list:
A regex that matches "begin with alphabet A & end with B, It also have 1 or more of either YO or OY in between":
If you mean "either (1 or more of YO) or (1 or more of OY), then the regex is