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
Post a Comment