从比赛中生成正则表达式 [英] Generate RegEx from matches

查看:38
本文介绍了从比赛中生成正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从给定的匹配项生成RegEx模式
例如,我想从以下匹配项数组中获取< b> \ d +< \ b>

I want to generate RegEx Pattern from a given matches
for example i want to get <b>\d+<\b> from the following array of matches

< b> 1</b>
b 2/b
< b> 3</b>
< b> 4</b>
< b> 5</b>
...

有什么想法吗?

<b>1</b>
<b>2</b>
<b>3</b>
<b>4</b>
<b>5</b>
...

any ideas?

推荐答案

工具

答案到类似的问题,下面的链接可能会帮助您:

Tool

From an answer to a similar question, the link below may help you:

txt2re :在线正则表达式生成器.

txt2re: Online regular expression generator.

了解

如果您寻求对该主题的更深入理解而不是快速解决方案,则应阅读以下问题的答案: 是计算机可能会通过用户提供的示例来学习"正则表达式?

Understanding

If you search for deeper understanding of the topic instead of a quick solution, you should read answers to following question: Is it possible for a computer to "learn" a regular expression by user-provided examples?

如果您想自己编写一个快速的解决方案,请尝试 此答案 .

If you want to code a quick solution yourself, this answer worths to look.

如有意义的 笑话 所示,请不要忘记 <一个href ="http://www.regexmagic.com/autogenerate.html" rel ="nofollow noreferrer">计算机无法读懂您的思想 ,并且同一输入可以生成多个不同的正则表达式

As indicated with the meaningful joke, don't forget that computers cannot read your mind, and several different regexes can be generated for the same input.

这篇关于从比赛中生成正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆