#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    I'm reading "Professional PHP Programming," and in it, the authors say that slash-dot, (.), represents a literal dot, ...but one of the book's examples uses slash-slash-dot (.).


    Can someone explain this discrepancy? (I'm new to RE's.)


    here's the example for validating an email address: ^.+@.+..+$
    why isn't it ^.+@.+..+$
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    One more thing,

    I'm parsing a page (that's stored as a string) so I'll just end up with the links on the page. Using (<[aA].+/[aA]> ) gets me the first occurance of <a href...> and the last occurance of </a>.

    I want to each individual link by itself.

    Anyone know how to fix this code? I've been toying around w/ it and haven't gotten it yet.

    //ryan
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    14
    Well, the backslash character is used to "escape" any sepcial meta-characters. I guess that means that someone wants to find the backslash character literally...
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    hehe - been there - its a pain innit! -

    you first have to explode() or split() the string, so each element contains just one link - then run the regex, I usually explode by "a>" leaving me "</" for the regex search

    See this brief tut' at http://www.firepages.com.au/news.htm it shows pretty much the same thing.

    PS if you use eregi() you can forget having to test for 'a' and 'A'

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

Similar Threads

  1. regular expressions
    By tdennist in forum C Programming
    Replies: 2
    Last Post: January 18th, 2004, 06:01 AM
  2. Getting parts outof text with regular expressions
    By GGK in forum PHP Development
    Replies: 8
    Last Post: August 31st, 2003, 07:31 AM
  3. using regular expressions in ErrorDocument 404 custom redirect??
    By wolfespawn in forum Apache Development
    Replies: 1
    Last Post: March 19th, 2003, 12:09 PM
  4. regular expressions in java
    By anulok in forum Java Help
    Replies: 2
    Last Post: March 5th, 2003, 09:53 AM
  5. Recursive patterns in regular expressions
    By JMM in forum Perl Programming
    Replies: 0
    Last Post: December 15th, 2001, 06:08 PM

IMN logo majestic logo threadwatch logo seochat tools logo