demon_athens Posted May 20, 2007 Share Posted May 20, 2007 I want to check a form field and give an error if found " \\n" or "\\are" strings in the field so I tried eregi and preg_match but I couldn't do it. any ideas? my wrong code is if(eregi("\\n",$value)) {$spam = 1;} if(preg_match("/\b\\n/i", $value)) {$spam = 1;} seems "\\" characters create problem. my final thoughts is to use explode, but it doesn't feel right. Link to comment https://forums.phpfreaks.com/topic/52242-solved-check-a-field-for-a-specific-string/ Share on other sites More sharing options...
trq Posted May 20, 2007 Share Posted May 20, 2007 If your looking for the literal string \\n you would use... if(eregi("\\\\n",$value)) {$spam = 1;} Link to comment https://forums.phpfreaks.com/topic/52242-solved-check-a-field-for-a-specific-string/#findComment-257743 Share on other sites More sharing options...
demon_athens Posted May 20, 2007 Author Share Posted May 20, 2007 thank you very much! Link to comment https://forums.phpfreaks.com/topic/52242-solved-check-a-field-for-a-specific-string/#findComment-257755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.