Regex Help required pls

Discussion in 'PHP' started by mbk, Nov 19, 2009.

  1. #1
    Hi,

    I have the following html code and need to extract only the piece after the rvo_model - so in this case MFC5860CNU1

    <script type="text/javascript">
    					rvo_retailer_ref='msc';
    					rvo_manufacturer='Brother';
    					rvo_model='MFC5860CNU1';
    					rvo_format='image_horizontal310x70';
    				</script>
    
    HTML:
    I am sure I will need to use Regex but as I am only just learning about PHP and Regex this is too complicated for me at present.

    Can someone else help please?

    Thanks
     
    mbk, Nov 19, 2009 IP
  2. cignusweb

    cignusweb Peon

    Messages:
    147
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have same problem Please help us
     
    cignusweb, Nov 19, 2009 IP
  3. org

    org Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey I wrote that for you and it works!

    <?php
    $text = "<script type=\"text/javascript\">
                        rvo_retailer_ref='msc';
                        rvo_manufacturer='Brother';
                        rvo_model='MFC5860CNU1';
                        rvo_format='image_horizontal310x70';
                    </script>"; 
    
    preg_match("/rvo_model=\'(.*)\'/", $text, $matches);
     
    echo $matches[1]; 
    ?>
    PHP:
    org
     
    org, Nov 19, 2009 IP
  4. dulcificum

    dulcificum Active Member

    Messages:
    535
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    68
    #4
    Read some regex tutorials. It is easy.
     
    dulcificum, Nov 19, 2009 IP