I really had big troubles understanding all the preg_ functions in pset 6, 7 and 8, especially its cryptic first argument which is called a regular expression and looks like this: /^\d+$/

preg_match("/^\d+$/", $_POST["shares"])

I hope I can save someone some headache:

Eventually this website helped me understand regular expressions and that they are a very powerful tool every programmer should know:

Read here only the first paragraph: http://www.regular-expressions.info/index.html then head directly to the Quick Start Section: http://www.regular-expressions.info/quickstart.html

It's worth to spend some minutes there. CS50 Staff should have add this links into the problem sets recommended reading list!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .