@NogDogFeb 02.2005 — #It should be: [code=php] preg_match("/([0-9]{4})/",$templatefile,$matches); [/code] The first parameter is the pattern to search for. [list]
[*]The '/' characters surround the entire search pattern (there are optional regexp arguments which can follow the end '/')
[*]The parentheses (probably unnecessary in this example) are grouping everything inside of them, and if it matches, the part of the string matched will be stored in variable $1 (each successive pair of parentheses being saved as $2, $3, etc.)
[*][0-9] means match any number from 0 to 9
[*]{4} means the preceding character must repeat for an exact total of 4 times
[/list] The second parameter is what is to be searched.
The third parameter (optional) is an array which will store all matches found.
So, your preg_match is saying to search $templatefile for each sequence of 4 numbers from 0-9, and save any matches found in array $matches.