Previous Entry Share Next Entry
(no subject)
2012
unknownj
Ten bonus points if you can work out what I'm trying to do with this code here:

substr(substr(email,index(email,'@')),index(substr(email,index(email,'@')),'.'))

Your time starts.... now!

  • 1
i believe what you're trying to do is this: you're trying to make us guess what it is you're trying to do with the code.

so the first bit finds everything after @ in string email, and the second bit finds the location of the first . after the @ in string email. Then you return everything after the first dot that comes after the @.

Or in other words you getting the domain extension from emails.

Unless they have bob@azz.gouranga.com, in which case you'd get gouranga.com, right?

Suppose you couldn't use the last index since .co.uk et al wouldn't work..

What language you using?


I agree, and I assume there's some reason not to use temporary variables (other than obfuscation for the likes of us)?

No such thing the way I code stuff.. that's just lifted straight out of a SQL query, so everything has to run all at once..

Did wonder whether that was the case, I'm used to having to provide number of characters as an argument to substr() for SQL so figured I wouldn't assume.

Exactly..

It is in fact specifically for people with @azz.gouranga.com type addresses.. To find general ISPs, I can just use the first bit, that finds everything after the @ (so @btopenworld.com etc.), but for ISPs that give you a subdomain, I had to go one step further into it and look at what comes after the first dot after the @ in order to identify the ISPs en masse..

As for the language, it's Teradata SQL..

  • 1
?

Log in

No account? Create an account