Preg_match Question

Discussion in 'PHP' started by Freewebspace, Jan 18, 2007.

  1. #1
    I want to know how to use PREG_MATCH

    and how to separate the variables

    suppose of if we are looking for the url in atext

    how to search for it

    suppose we want the word after about to be matched with the the numbers how should I write this code

    I want the real explanation of the code like this
    '/' and how do we separate the words and why the tag is like <\/b\>
    this
     
    Freewebspace, Jan 18, 2007 IP
  2. West

    West Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The best to learn about this is: http://www.php.net/preg_match

    Please make sure you read the examples. The commented code explains a little bit about this stuff.

    Also, for reading sake take a look at this: http://www.microcyb.com/?m=c&c=494

    This is a pretty good explanation of RegEx (Regular Expression) matching.
     
    West, Jan 18, 2007 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    The best way to learn about regular expressions is by practice.

    You do not need to escape < > , in the format.

    Also the expression shouldn't have \/si' ending, but rather /si' ending (start/end chars do not get escaped).

    Peace,
     
    Barti1987, Jan 18, 2007 IP
  4. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #4
    Thanks for the link

    The second site you recomended had all the answers
     
    Freewebspace, Jan 18, 2007 IP
  5. West

    West Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Glad to know I have helped you. :)
     
    West, Jan 18, 2007 IP