Click here to Skip to main content
15,902,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
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
Posted
Comments
PIEBALDconsult 27-Nov-14 13:50pm    
To anyone just joining in, this is a follow-on to:
http://www.codeproject.com/Answers/842584/help-with-formatting-a-text-with-regex?arn=0#answer2

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!
 
Share this answer
 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900