Coreye Posted February 24, 2008 Share Posted February 24, 2008 I'm working on a script where you enter a command then a username then a 3rd arguement (in this case a hex code). This works: $message = "/color Hood15 000"; if (ereg ("^/(ban|color|invisible) (.*) (.*)", $message, $cmd)) But I want the username and the 3rd argument to have quotes around them (single or double I really don't care at this point). Such as $message = "/color 'Hood15' '000'"; I assumed this regex would work but it doesn't. if (ereg ("^/(ban|color|invisible) '(.*)' '(.*)'", $message, $cmd)) I've tried several other variations such as ['(.*)'] and other stuff too but I just can't get it to work. Quote Link to comment Share on other sites More sharing options...
ucffool Posted February 24, 2008 Share Posted February 24, 2008 Do you want the INPUT to have quotes or the OUTPUT? If it is the output, that would be pretty straightforward and not part of the regex. If it is the input, you could make it something like: eregi ("^/(ban|color|invisible) ('[a-z0-9_-]') ('[a-z0-9]')", $message, $cmd Using eregi so it ignores case. Quote Link to comment Share on other sites More sharing options...
Coreye Posted February 24, 2008 Author Share Posted February 24, 2008 It's the INPUT we are trying to do. Thanks for the suggestion, but that didn't work. Quote Link to comment Share on other sites More sharing options...
Coreye Posted February 25, 2008 Author Share Posted February 25, 2008 Thanks, I got it working now . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.