Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin

tommcfarlin/1-path.js Secret

Last active Aug 29, 2015
Embed
What would you like to do?
An example of how to use a regular expression to extract a piece of information from mixed HTML and JavaScript.
var SysLocalPath = "/abc123z";
<?php
// Request the response from the URL
$url_send = "https://dataquery.domain.com/?profile=$profil&acme=$data";
$result = file_get_contents( $url_send );
// Find the unique ID and store it in $matches
preg_match( "/(SysLocalPath)\s?(=)\s?(.*)/", $result, $matches );
<?php
$data_id = preg_replace( "/[^a-z0-9.]+/i", "", $matches[ count( $matches ) - 1 ] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.