سؤال

I've implemented NSDataDetector to detect URLs, but it includes email addresses as well. Is there an easy way to make it not detect emails, but all other URLs?

هل كانت مفيدة؟

المحلول

Well, email addresses are not URLs. mailto:someone@some.where.com is a URL which contains an email address. So, to answer your question: Check whether your URL begins with mailto:. If it does, ignore it. If for some reason you're picking up email addresses as URLs, you probably have some parsing bug...

See here about regular expressions for URLs.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top