Bummer! Okay, Apache 1.x makes a difference as you do need the leading / in your regex (if you're going to use the start anchor, ^).
RewriteRule ^/?dir1/dir2/([a-zA-Z0-9]*)$ dir1/dir2/index.php?ident=$1 [L]
Your code is just fine as ^/? is accepted by both Apache 1.x AND Apache 2.x so, if your host upgrades (as they should), you'll be all set.
dir1/dir2/ are static directories so no problem (so long as your index.php script IS located in dir2).
The ([a-zA-Z0-9]*) atom is lowercase and uppercase letters and digits, zero or more, and is terminated by the end anchor - PERFECT (so long as your value is ONLY letters and digits - no example provided)!
The redirection is based on the current location (DocumentRoot) so the dir1/dir2 is fine as is the index.php. The ident key is then assigned the value captured by the atom in the regex and the mod_rewrite block is terminated (as in ; or }) by the Last flag.
At this point, I have to ask for the test URI that you are using for this redirection (and the target URI).