Estoy tratando de validar que el enlace que estoy ingresando en un formulario es un enlace válido de Google Earth; sin embargo, acepta todos los enlaces excepto el enlace de Google Earth; aquí está el código para mi script js con el que estoy tratando de hacer esto.
validate: function() { var inputFields = $('input[type=text]'); var notAvailable = $('#op_not_available'); var GoogleEarthUrl = $('#op_gooogle_earth_link').val().trim(); var twitterUrl = $('#op_twitter_url').val().trim(); var urlRegex = /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[az]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/; var GoogleEarthRegex = /google.com/; var twitterRegex = /twitter.com/; if (!notAvailable.prop("checked")) { $("#not_available").val('off'); for (var i = 0; i < inputFields.length; i++) { if (!$(inputFields[i]).val().trim().length) { return 'Please enter all fields'; } } if ((GoogleEarthUrl !== '-') && !(urlRegex.test(GoogleEarthUrl) && GoogleEarthRegex.test(GoogleEarthUrl))) { return 'Please enter a valid Google Earth URL'; } if ((twitterUrl !== '-') && !(urlRegex.test(twitterUrl) && twitterRegex.test(twitterUrl))) { return 'Please enter a valid Twitter Url'; } }else{ $("#not_available").val('on'); } return; } };