Quiero tener la expresión regular que asegure que el comienzo de la cadena contenga 'http: //' y '/' y el final.preg_match: asegúrese de que el inicio y el final contengan algo
Ésta es una versión más larga que se me ocurrió,
if(!preg_match("/(^http:\/\//", $site_http))
{
$error = true;
echo '<error elementid="site_http" message="site_http - Your link appears to be invalid. Please confirm that your link contains http:// at the start."/>';
}
elseif (!preg_match("/\/$/", $site_http))
{
$error = true;
echo '<error elementid="site_http" message="site_http - Your link appears to be invalid. Please confirm that your link has ended with a /."/>';
}
pero pensé que estas dos expresiones se pueden poner juntos como abajo, pero no lo puedo trabajar,
if(!preg_match("/(^http:\/\/)&(\/$)/", $site_http))
{
$error = true;
echo '<error elementid="site_http" message="site_http - Your link appears to be invalid. Please confirm that your link contains http:// at the start and a/at the end."/>';
}
las múltiples expresiones que yo tratar de combinar debe estar mal! ¿alguna idea?
gracias, Lau
¿Puede dar una muestra de cuerdas? – Codex73