a regex to handle both URL form and ID form that i use is (allows the user to not care, if they paste the url OR just the ID):

Code
(|.*v=)([a-zA-Z0-9]{8,12})(|&.*)

markup:

Code
<object width="425" height="350">
 <param name="movie" value="http://www.youtube.com/v/\\2"></param>
 <param name="wmode" value="transparent"></param>
 <embed src="http://www.youtube.com/v/\\2"
  type="application/x-shockwave-flash" wmode="transparent"
  width="425" height="350">
 </embed>
</object>

note: forces www.youtube.com in the markup smile

feel free to embellish and/or ignore wink