The best suggestion I have is to find (or invent) some interesting problems, then play with Expresso to solve them (in as many ways as you can think of).
Having said that, remember that regex is not the universal solution for string processing. There are many cases where regex is not the appropriate tool.
(Remember the old saw "When all you have is a hammer, everything looks like a nail." Don't let regex become your hammer.)
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
i am doing a project, i want to match a string with regex which will match the whole string and it dosent allow two white spaces concerrently on after the other and also it dosent allow white spaces at starting and ending of string, any number of white spaces is allowable but not concurrently one after the other
I want to:
1) count the number of round brackets '(', I expect as result 2
2) get the text inside, I expect "\"Happy"\", which appear in console output as "Happy"
No idea for 1. I try the following for 2
string k = Regex.Match(s1,@"\((\w+)\)").Groups.Value;
But It fails in understanding the \" character
You don't seem to be allowing any content between the <a> and </a>. I think you need (.*) in there (it should be a replacement group because it's what you want to keep), and the matching to be done non-greedily.
Also, you don't allow for multiple <a> inside the same <pre>.
I don't really think regex is the right tool for this job, as there's lots of context and state-change in what you're trying to do. An XML based solution seems better to me. But something like
... in non-greedy mode and writing all the found groups into the output might work.