我该如何处理这个正则表达式 [英] how do I handle this regex

查看:86
本文介绍了我该如何处理这个正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

这是我尊敬的代码项目中的第二个问题。我不是程序员,但我寻求你的帮助来生成一个正则表达式来解决以下问题。我有很多文档,我需要更改问题的格式:

Hello
This is my second question in your respected "code project". I am not a programmer but I seek your help to generate a regex to solve the following problem. I have a great number of docs and I need to change the formatting of the questions from:

1- Sam ......... to the club everyday.
a)go        b)goes        c)went      d)gone

PS:这四个选择之间有不规则的空格。

我想改成它像这样:

P.S : there are irregular spaces between the four choices.
I'd like to change it to be like that:

1. Sam ......... to the club everyday.
a. go
b. goes
c. went
d. gone



我将非常感谢你的帮助。

感谢


I would appreciate your help.
thanks

推荐答案

作为Piebald已经指出,这与你上次的问题几乎相同:解决这个问题对正则表达式来说是一个相对较小的改变。



但是...我我不打算这样做!相反,我宁愿给你自己做的工具 - 这样,你每次在文件中找到另一个案子时都不会问我们(你会的,你会的)。



所以...到这里: Ultrapico.com [ ^ ]并下载Expresso的副本。它是免费的,它可以检查,测试和解释正则表达式 - 在尝试编写它们时也会有很大帮助。我经常使用它,并希望我写它!



当你有副本时,将最后一个正则表达式加载到它,以及你的旧样本数据和播放用它:看看正则表达式是如何工作的,并了解它们。然后调整它以获取新数据。并继续测试,直到您满意为止。它可能看起来更慢,但从长远来看,它会为你节省大量的时间!
As Piebald has pointed out, this is pretty much the same problem as you had last time: it's a relatively small change to the regex to solve this.

But...I'm not going to do it! Instead, I'd rather give you the tools to do it yourself - that way, you won't have to ask us each time you find another case in your documents (and you will, you will).

So...go here: Ultrapico.com[^] and download a copy of Expresso. It's free, and it examines, tests, and explains Regexes - and it also helps a lot when trying to write them. I use it, a lot and wish I'd written it!

When you have a copy, load the last Regex into it, and your old sample data and play with it: look at how the regex works, and get a feel for them. Then tweak it for your new data., and keep testing until you are happy it works. It may seem slower, but in teh long run, it's going to save you a heck of a lot of time!


我的问题似乎让你感到不安。我非常抱歉。顺便说一句,我正在尝试理解正则表达式,我已经下载了一些教程来理解它。但是,我仍然是初学者,我需要帮助那些复杂的正则表达式。

无论如何,谢谢你的反馈
It seems that I have disturbed you with my questions. I am extremely sorry. By the way I am trying to understand regex and I have downloaded some tutorials to understand it. However, I am still a beginner and I needed help with those "complex" regex.
Anyway thank you for your feedback


这篇关于我该如何处理这个正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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