bastones Posted June 29, 2008 Share Posted June 29, 2008 Error: Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/ben/public_html/Bazaark/edit_profile.php on line 142 I have a script that lets users edit their profile. The only thing I last did on it was add filters using the preg_match function; a few days a go it was working fine and since yesterday these compilation errors have been coming up. I have tried contacting my Web host about it but they are so inexperienced they say its to do with my script. I have checked my script over 100 times and the syntax and everything seems to be fine. Does anybody know what could be causing this error? Link to comment https://forums.phpfreaks.com/topic/112454-warning-preg_match-functionpreg-match-compilation-failed-nothing-to-repe/ Share on other sites More sharing options...
ToonMariner Posted June 29, 2008 Share Posted June 29, 2008 some code would be ace... some based around line 142 in edit_profile would be phenominal... but the actual error is down to your preg_match not having any regex patter to match against. Link to comment https://forums.phpfreaks.com/topic/112454-warning-preg_match-functionpreg-match-compilation-failed-nothing-to-repe/#findComment-577375 Share on other sites More sharing options...
bastones Posted July 2, 2008 Author Share Posted July 2, 2008 The starting bit of the code is line 142: if(preg_match($match1,$profile) || preg_match($match2,$profile) || preg_match($match3,$profile) || preg_match($match4,$profile) || preg_match($match5,$profile) || preg_match($match6,$profile) || preg_match($match7,$profile) || preg_match($match8,$profile) || preg_match($match9,$profile) || preg_match($match10,$profile) || preg_match($match11,$profile) || preg_match($match12,$profile) || preg_match($match13,$profile) || preg_match($match14,$profile) || preg_match($match15,$profile) || preg_match($match16,$profile) || preg_match($match17,$profile) || preg_match($match18,$profile) || preg_match($match19,$profile) || preg_match($match20,$profile) || preg_match($match21,$profile) || preg_match($match22,$profile) || preg_match($match23,$profile) || preg_match($match24,$profile) || preg_match($match25,$profile) || preg_match($match26,$profile)) { echo "<b><font color='red'>WARNING: Your profile contained material that was recognised by our filter! This includes (without limitation); offensive and/or discriminating language, posting personal information (including mobile phone numbers), swearing, linking to websites not approved by us, etc. Go back and rectify the problem.</font></b>"; } EDIT: I found out that this error occurs when you enter text not filtered by preg_match. :S Link to comment https://forums.phpfreaks.com/topic/112454-warning-preg_match-functionpreg-match-compilation-failed-nothing-to-repe/#findComment-579929 Share on other sites More sharing options...
bastones Posted July 2, 2008 Author Share Posted July 2, 2008 fixed, I added a $match25="/+/" which shouldn't be done like that... how do I just filter the character + ? Link to comment https://forums.phpfreaks.com/topic/112454-warning-preg_match-functionpreg-match-compilation-failed-nothing-to-repe/#findComment-579936 Share on other sites More sharing options...
effigy Posted July 2, 2008 Share Posted July 2, 2008 \+ Why so many matches? What are in these patterns? Link to comment https://forums.phpfreaks.com/topic/112454-warning-preg_match-functionpreg-match-compilation-failed-nothing-to-repe/#findComment-580032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.