SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help on regular expression

    I have a follwing code in an HTML page...

    I need to extract the parameter of the encodeURIComponent method..

    I am not very good at using regular expressions....

    the parameter is random and automatically generated by the javascript.

    what i need to do is extract the parameter using a PHP script.

    I would really appreciate if somebody helped me regarding this

    Code:
    so.addVariable('ticket', encodeURIComponent('duqRqPup5KOE4XDfvrxDkFW3aqq6CXHrEN3IlxtCamMbwtGooQDXzHekJ7j6gellLjJfLavOkjIQSC15/vdayw=='));

  2. #2
    Use The Cloud
    Join Date
    Jan 2006
    Location
    Boise, ID
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like this?

    PHP Code:
    $string "so.addVariable('ticket', encodeURIComponent('duqRqPup5KOE4XDfvrxDkFW3aqq6CXHrEN3IlxtCamMbwtGooQDXzHekJ7j6gellLjJfLavOkjIQSC15/vdayw=='));";

    $matches = array();
    preg_match("/encodeURIComponent\('([^']*)'\)/"$string$matches);
    $component $matches[1]; 
    Brad Hanson, Web Applications & Scalability Specialist
    ► Is your website outgrowing its current hosting solution?
    ► PM me for a FREE scalability consult!
    ► USA Based: Available by Phone, Skype, AIM, and E-mail.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •