How to convert a JavaScript regex into Java? -


i have been using regex validate youtube links using javascript:

function is_valid_video(url) {         var p = /^(?:http?:\/\/)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\s+)?$/;         return (url.match(p)) ? regexp.$1 : false;     } 

since i'm learning develop android apps, want convert function use in java.

public static bool is_valid_video(string url) { return url.matches("your regex goes here"); } 

read this article more help.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -