It involves regular expressions for pattern matching. the stuff that looks like:
/[(.)](.)/
are regular expressions.
The characters have very distinct meanings. Basically this one is:
/ - in preg_match you need a delimiter at the beginning and end of the expression. / is typically used.
[ - match one left bracket. The \ needs to go in front because [ is a special character in regular expressions.
(.*) - a period means match any character, and the star following it means match any number of them. It's in parentheses so whatever is in the parentheses can be referenced later ($matches[1])
] - match one right bracket. Again it needs a \ in front of it because ] is a special character and therefore needs to be escaped.
(.*) - this again...match any number of characters any number of times, and keep it for reference later
/ - ending delimiter
the $matches parameter means to put the matches in an array called $matches.
If you really want to learn regular expressions, read "Mastering Regular Expressions" by O'Reiley. This example is very very basic, they can get incredibly complex.
-Jim Keller
http://www.centerfuse.net