0Pricing
NLP Academy · درس

العثور على عناوين البريد الإلكتروني وعناوين URL

استخرج معلومات الاتصال من نص غير منتظم

العثور على عناوين البريد الإلكتروني وعناوين URL درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Patterns Hide in Messy Text

Real text is full of structured snippets like emails and links. Regex lets you pull these out automatically, even from long, messy documents.

What an Email Looks Like

An email has a name, an at sign, a domain, and an extension. Spotting that shape is the first step to writing a pattern for it.

A Simple Email Pattern

This email pattern grabs word characters, an at sign, more characters, a dot, and letters. It is not perfect, but it catches most real addresses.

re.findall("\w+@\w+\.\w+", "hi a@b.com")

Why the Dot Needs Escaping

In a domain you want a literal dot, not the any-character dot. So you escape it as \. to match only a real period in the address.

Extracting Many Emails at Once

Pair your email pattern with re.findall to sweep an entire document and return every address it contains as a clean Python list.

emails = re.findall(pattern, text)

What a URL Looks Like

A URL usually starts with http or https, then ://, then a domain and path. That predictable start makes it a great target for regex.

A Starter URL Pattern

This URL pattern matches http or https, then any non-space characters. The optional s after http is written with a question mark quantifier.

re.findall("https?://\S+", text)

Optional Parts With the Question Mark

The question mark makes the part before it optional. In https? the s may or may not be there, so both http and https match cleanly.

Greedy Matching Can Overreach

By default quantifiers are greedy and grab as much as they can. With URLs this can swallow trailing punctuation you did not want.

Tame It With Boundaries

Use \S to stop at the first space, or trim the result afterward. Knowing where a match should end keeps your extraction tidy.

Test on Real Samples

Always test your pattern on messy real text. Edge cases like plus signs in emails or query strings in URLs reveal where it still leaks.

Quick Check

You want http to be optional in the s only. Which symbol makes the preceding character optional?

Recap: Pulling Out Contact Info

You built patterns for emails and URLs, escaped literal dots, and used the question mark for optional parts. Now you can mine contact info from text. 🔍

الأسئلة الشائعة

هل درس «العثور على عناوين البريد الإلكتروني وعناوين URL» مجاني؟

نعم — نص درس «العثور على عناوين البريد الإلكتروني وعناوين URL» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.

ماذا ستتعلم في «العثور على عناوين البريد الإلكتروني وعناوين URL»؟

استخرج معلومات الاتصال من نص غير منتظم تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟

لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «العثور على عناوين البريد الإلكتروني وعناوين URL»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟

نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. التعبيرات النمطية في 5 دقائق
  2. العثور على عناوين البريد الإلكتروني وعناوين URL
  3. مجموعات الالتقاط والاستبدالات
  4. حيل تقسيم النص بالـ Regex
← العودة إلى NLP Academy