In perl, following a regex, you can access matched information at the paranthesis level using variables later on like so:
ex:
$search =~ /(\d{5}(-\d{4})?)/g;
All information above is contained in paranthesis set 1, while the (-\d{4}) is set 2. Later in the script, they could be accessed by the set number:
print "$1";
print "$2";
where $1 is set 1, and $2 is set 2. I have two questions: is this possible using the PCRE function set in PHP, and if so, what would happen with the following example:
$search =~ /((\d{3})? *(\d{3}( |.|-)+)(\d{4}))/g;
In that example, not only are paranthesis nested, but also exist on the same level, so to speak. (\d{3}) is on the same level as (\d{4}). How could you differenciate between them using variables as above?
Matt