the JS was one I nicked off a well known ecommerce website, which probably most of us on this list have bought something off! I'll let them know they suck.
it's to catch things like paul @ pjnet.com. and it works. .search returns -1 if it doesn't find a space. which is what we're testing for. so if it's not = -1, then it found a space. the reason for converting it is i'm not wanting to rely on client-side validation. so i've got page 1 has client-side validation. page 2 has server-side validation doing exactly the same thing, and redirecting to page 1 with appropriate error messages. i guess my conversion wasn't too good, as i just tried to do it literally as it was, rather than rethink it. Your suggestion worked though, thanks. Duncan Cumming IT Manager http://www.alienationdesign.co.uk mailto:[EMAIL PROTECTED] Tel: 0141 575 9700 Fax: 0141 575 9600 Creative solutions in a technical world ---------------------------------------------------------------------- Get your domain names online from: http://www.alienationdomains.co.uk Reseller options available! ---------------------------------------------------------------------- ---------------------------------------------------------------------- "Paul Johnston" <[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> tions.com> cc: Subject: RE: [ cf-dev ] js -> cf regex 11/06/2003 14:43 Please respond to dev > JS: if (form.EmailAddress.value.search(/[^\s]+\s+[^\s]/) != -1) > > CF: <cfif REFind("[^[[:Space:]]]+[[:Space:]]+[^[[:Space:]]]", > Form.EmailAddress)> It's hardly a good regex is it? Find something that isn't a space more than once, then find a space, then find something that isn't a space... Erm why would you look for that in an email address? Also, the JS states != -1 Which is basically saying not equal to -1, but if I'm right, it will return -1 when the regex is not found, so it's saying if(regex is not not found in the email address) So you are correct in trying to just do a REFind instead of a NOT REFind eq 0. But still, why do you want to convert the JS regex? Try the previous answer (too many []) otherwise, if it's CFMX, just copy it over as it should allow \s as space. Failing that, just put in "[^ ]+[ ][^ ]" This won't get tab chars or line breaks, but that's okay! It's just really unclear why you would want this. You could just trim the string (to get rid of preceding and trailing spaces) and then check for any [ ] because that would tell you exactly what you need to know! Paul -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]