1- E-Posta Adresi:

$email="test@example.com";
if(preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/',$email)){
echo"Your email is ok.";
}
else{
echo"Wrong email address format";
}

if(filter_var('test+email@fexample.com', FILTER_VALIDATE_EMAIL)){
echo"Your email is ok.";}else{echo"Wrong email address format.";
}

2- Kullanıcı Adı:

$username="user_name12";
if(preg_match('/^[a-z\d_]{5,20}$/i',$username)){
echo"Your username is ok.";
}else{
echo"Wrong username format.";
}

3- Telefon Numarası:

$phone="(021)423-2323";if(preg_match('/\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/x',$phone)){
echo"Your phone number is ok.";
}else{
echo"Wrong phone number.";
}

4- IP Adresi:

$IP="198.168.1.78";
if(preg_match('/^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',$IP)){
echo"Your IP address is ok.";
}else{
echo"Wrong IP address.";
}

5- Posta Kodu:

$zipcode="12345-5434";
if(preg_match("/^([0-9]{5})(-[0-9]{4})?$/i",$zipcode)){
echo"Your Zip code is ok.";
}else{
echo"Wrong Zip code.";
}

6- Sosyal Güvenlik Numarası:

$ssn="333-23-2329";
if(preg_match('/^[\d]{3}-[\d]{2}-[\d]{4}$/',$ssn)){
echo"Your SSN is ok.";
}else{
echo"Wrong SSN.";
}

7- Kredi Kartı Numarası:

$cc="378282246310005";
if(preg_match('/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/',$cc)){
echo"Your credit card number is ok.";
}else{
echo"Wrong credit card number.";
}

8- Domain:

$url="http://komunitasweb.com/";
if(preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i',$url)){
echo"Your url is ok.";
}else{
echo"Wrong url.";
}

9- URL:

$url="http://komunitasweb.com/index.html";
preg_match('@^(?:http://)?([^/]+)@i',$url,$matches);
$host=$matches[1];
echo $host;

10- Highlight:

$text="Sample sentence from KomunitasWeb, regex has become popular in web programming. Now we learn regex. According to wikipedia, Regular expressions (abbreviated as regex or regexp, with plural forms regexes, regexps, or regexen) are written in a formal language that can be interpreted by a regular expression processor";
$text=preg_replace("/\b(regex)\b/i",'<span style="background:#5fc9f6">\1</span>',$text);
echo $text;

Comments

  1. naked fat hot

    Derin sakso gırtlak porno vıdeolarını ücretsiz izle.
    derin sakso gırtlak sikiş filmleri oYoH ile izlenir, kesintisiz seks merkezi.

    Derin Sakso Gırtlak porno izle. 8:3. büyük memeli
    sarışın kaşar derin sakso 2. Turan bana döndü sarıldı ve omuzuma bir öpücük kondurarak Ağlıyormusun sen diye sordu, sonra onu alexis adams.

  2. aile anal son

    Genç afrikalı teen porno vıdeolarını ücretsiz izle.
    genç afrikalı teen sikiş filmleri oYoH ile izlenir, kesintisiz seks merkezi.
    Genç Afrikalı lezzie 69 birbirlerine sikişiyor seviyorum.
    Azdık kudurduk. Hani adam seni görmemişti? deyince, biran ondan nefret ettim.
    Bir çırpıda hallettim, beyaz maymun ve uyuşturucu.

  3. Monaree

    แนะนำเว็บเล่นเกมสล็อตสนุก MEGAGAME.LIFEมีฟีเจอร์ที่โดดเด่นโบนัสนัสแตกบ่อยให้ผู้เล่นเพลินไปกับกราฟิกสวยสมจริงลุ้นรางวัลตลอดการเข้าใช้งานmega slotแต่ละเกมสามารถเดิมพันได้ไม่จำกัดจะเข้าเล่นกี่ครั้งก็ได้เล่นกับเว็บเราไม่มีขาดทุนแน่นอน

  4. Koop furantoina online

    Simply want to say your article is as astonishing.
    The clarity to your post is just nice and that i could suppose
    you’re an expert in this subject. Fine along with your permission allow me to
    snatch your feed to stay up to date with forthcoming post.

    Thank you a million and please keep up the enjoyable work.

  5. aankoop van cytofine in België

    Hey there! I understand this is kind of off-topic however I needed to ask.
    Does running a well-established blog such as yours take a large amount of work?
    I’m brand new to running a blog however I do write in my diary
    on a daily basis. I’d like to start a blog so I can share my experience and
    views online. Please let me know if you have any kind of suggestions
    or tips for new aspiring bloggers. Thankyou!

  6. Josie

    Hi there, just became alert to your blog through Google, and found that
    it is truly informative. I’m going to watch out
    for brussels. I will appreciate if you continue this in future.

    Many people will be benefited from your writing.
    Cheers!

  7. Kevin Maeno

    Congratulations on your incredible gift for writing! Your article is an engaging and enlightening read. Wishing you a New Year full of achievements and happiness!

Bir Cevap Yazın

E-posta hesabınız yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Şu HTML etiketlerini ve özelliklerini kullanabilirsiniz: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>