I need to verify this codes in php with preg\_match but i dont manage regular expressions:

`R{1 TO 12}-{00 TO 99}-{00 TO 99}` Ej: R12-54-03

`Y-{A TO Z}` Ej: Y-Z

you can help me with this problem? I am a denied with regular expressions

all code should be in uppercase.

This question is problematic?

i use this code to parse the string:

```
$parts = explode("-",strtotupper($row['ubicacion']));
                    if(!empty($parts)){
                        if(is_array($parts)){
                            if(count($parts)==3){
                                if((strlen($parts[0]==2) || strlen($parts[0]==3)) && strlen($parts[1]==2) && strlen($parts[2]==2){
                                    $num = str_replace("R","",$parts[0]);
                                    if(is_numeric($num) && is_numeric($parts[1]) && is_numeric($parts[2])){
                                        if($num>=1 && $num <=12){
                                            $parse = true;
                                        }
                                    }
                                }
                            }
                        }
                    }

```