The Little Guy Posted September 14, 2008 Share Posted September 14, 2008 How can I do a regular expression? I have tried this: SELECT * FROM `stats` WHERE REGEXP '^http://phpsnips.com*' but, I get an error. Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/ Share on other sites More sharing options...
JasonLewis Posted September 14, 2008 Share Posted September 14, 2008 You need to specify the column on which to perform the Regular Expression on. SELECT * FROM `stats` WHERE `field` REGEXP '^http://phpsnips.com*' Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/#findComment-640805 Share on other sites More sharing options...
The Little Guy Posted September 14, 2008 Author Share Posted September 14, 2008 OK Figured it out! Question... How can I take this: SELECT * FROM `stats` WHERE `currentLocation` REGEXP '^http://phpsnips.com*' so it says "where currentLocation !=" what is in the REGEXP? Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/#findComment-640809 Share on other sites More sharing options...
JasonLewis Posted September 14, 2008 Share Posted September 14, 2008 Try this: SELECT * FROM `stats` WHERE `currentLocation` REGEXP '[^http://phpsnips.com]' Why don't you just use != ? Here is a good reference for MySQL Regex. Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/#findComment-640810 Share on other sites More sharing options...
The Little Guy Posted September 14, 2008 Author Share Posted September 14, 2008 Thanks, looks like it worked! I was looking at that like b4 Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/#findComment-640814 Share on other sites More sharing options...
The Little Guy Posted September 14, 2008 Author Share Posted September 14, 2008 Just kidding, doesn't look like it worked Link to comment https://forums.phpfreaks.com/topic/124123-solved-regexp/#findComment-640818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.