Regex help

Discussion in 'PHP' started by thesurface, Nov 10, 2012.

  1. #1
    YFSy5osoQRcM7WrgD4mFl[69/74] - "R8fwVK86BCPRueldnSYD-sample-sample.vol03+04.par2" yEnc (1/3) (1/3)

    I need to get R8fwVK86BCPRueldnSYD from it, is that possible ?

    Or to get YFSy5osoQRcM7WrgD4mFl
     
    Last edited: Nov 10, 2012
    thesurface, Nov 10, 2012 IP
  2. ROOFIS

    ROOFIS Well-Known Member

    Messages:
    1,234
    Likes Received:
    30
    Best Answers:
    5
    Trophy Points:
    120
    #2
    Here you go try this:
    (greedy-less syntax)

    <pre>
    <?php
    $data = 'YFSy5osoQRcM7WrgD4mFl[69/74] - "R8fwVK86BCPRueldnSYD"-sample-sample.vol03+04.par2" yEnc (1/3) (1/3)';
    preg_match('/[^\[]*/', $data, $find); //This one works for 1st match!
    echo '1st match: '.$find[0]."\n";
    #or
    ##print_r($find);
    
    preg_match('/\s"(.*?)"/', $data, $find); //This one works for 2nd match!
    echo '2nd match: '.$find[1]."\n";
    #or
    ##print_r($find);
    ?>
    </pre>
    PHP:


    :)




    ROOFIS:cool:
     
    ROOFIS, Nov 10, 2012 IP