<?php
preg_match('|http://www.example.com/(.*)-(.*)-(.*)|', 'http://www.example.com/usa-florida-1234', $matches);
print_r($matches);
$country = $matches[1];
$city = $matches[2];
$code = $matches[3];
UPDATE:
Each character in a regular expression is either understood to be a metacharacter with its special meaning, or a regular character with its literal meaning.
The pattern is composed of a sequence of atoms. The simplest atom is a literal, but grouping parts of the pattern to match an atom will require using ( ) as metacharacters.
When you match a pattern within parentheses, you can use any of $1, $2, ... or \1 \2 ...(depending on the matcher!) later to refer to the previously matched pattern.
in the example above:
| (pipe) - in the example above defines start and the end of the pattern
() - both meta-characters ( and ) a grouped parts of the pattern
. (dot) = meta-character; matches any single character
* (asterisk) = meta-character, quantifier; defines how often that preceding element(character or group, sub expression) is allowed to occur
Having that in mind:
(.*) resolves as a match for later reference a group made of any characters that occur zero or multiple times
And :
|http://www.example.com/(.*)-(.*)-(.*)|
Equals to match:
Any occurrence in the text of a string that contains the string http://www.example.com/ followed by any character zero or multiple times before the - character than again followed by any character zero or multiple times before - character followed by any character zero or multiple times.