Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PHP's preg_match in Java [regex]

807580Jan 18 2010 — edited Jan 18 2010
Ok, I have this code in PHP:
$url = 'http://www.youtube.com/watch?v=TUZwdbeS2mM';
preg_match("/v=([^(\&|$)]*)/", $url, $matches);
$vid = $matches[1];
$vid would be TUZwdbeS2mM.

Now, I would like to do this in Java but I've never used regex in Java. I'm guessing the actual regex code is exactly the same, but I need a substitute for the function preg_match.

Thank you all!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2010
Added on Jan 18 2010
3 comments
865 views