Jump to content

Reg Expression Routine, Issue With Dash Character


son

Recommended Posts

I check some input fields before letting user upload data. Now I found that the dash character prevents user uploading data although I allowed it in my reg expressions. I would appreciate if you had a look at:

if (!eregi ('^[[:alnum:]\ \:\-\?\&]{2,200}$', stripslashes(trim($_POST['heading'])))) {	$h = FALSE;	$errors['heading'] = '\'Heading\' not in correct format or too long';	} else	{		$h = escape_data($_POST['heading']);	$heading_echo = $h;	}

I also tried without the dash escaped? Where am I going wrong?Son

Link to comment
Share on other sites

Moved now the dash character to the end and works as:if (!eregi ('^[[:alnum:]\ \:\?\&\-]{2,200}$', stripslashes(trim($_POST['heading'])))) {Does anyone know what is the difference? Although it is working now, do not really get why it did not work before...Son

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...