Tuesday, April 20, 2010

How do I ask a question about regular expressions?

We are getting more and more regular expression questions being asked and people have a tendency to not give us enough details to work with.  The best method is to post an example of the string you are working with and follow that with a list of the expected matches.  If you are refering to web page html code then either give us a link to  the page or post enough of the page that it includes all of the functional bits that you want to parse and that means some of the code on both sides of the element that you want to work with.

That gives us a starting point and you will usually get a working answer or an answer that is very close and only needs a bit of touch up to be what you want it to be.

No comments: