Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Regular Expression tutorial??

  1. #11
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Wow, that was awesome. Thanks mwinter, let me read all that(sorry I am at school now).

  2. #12
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmmm... a lot to work through if new, but that's a good explanation.
    Thanks, Mike.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #13
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yea, a lot of work. I have even saved a copy of that(as a .txt file) for future references. Thanks again mwinter.

  4. #14
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I'm testing this out (actually it's helping me with a script that i'm writing), and I was wondering what's wrong with this:
    PHP Code:
    if (preg_match("([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]+"$url) == 1) {
    dostuff();

    It's not being true.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #15
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Firstly, you should use delimiters:
    Code:
    /([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]+/
    Subdomains, anyone? .co.uk?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •