Can somebody convert this ereg() expression to preg_match()

Discussion in 'PHP' started by DSaNDun, Nov 3, 2009.

  1. #1
    EDIT: FIXED

    Hi I need to convert following expression to preg_match

    ereg("<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>",$str,$reg)
    PHP:
    I tried the following code and it gives me "Warning: preg_match() [function.preg-match]: Unknown modifier '?' in " error.

    preg_match("/<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>/",$str,$reg)
    PHP:

    Any help? :confused:
     
    Last edited: Nov 3, 2009
    DSaNDun, Nov 3, 2009 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    I'm not very good at regexp but I'll try to help. What are you trying to match?
     
    Sky AK47, Nov 4, 2009 IP
  3. DSaNDun

    DSaNDun Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Never mind Fixed that. :)

    Correct code

    preg_match("/<(\/\?[[:alpha:]]*)[[:space:]]*([^>]*)>/",$str,$reg)
    PHP:
     
    DSaNDun, Nov 4, 2009 IP
  4. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what do you want to match exactly?
    I will build up one for you..
     
    xenon2010, Nov 4, 2009 IP
  5. DSaNDun

    DSaNDun Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks alot for trying to help me. I already sorted out it by my self :)
     
    DSaNDun, Nov 4, 2009 IP