Skip to content

Instantly share code, notes, and snippets.

@tareko
Created October 17, 2012 05:12
Show Gist options
  • Select an option

  • Save tareko/3903808 to your computer and use it in GitHub Desktop.

Select an option

Save tareko/3903808 to your computer and use it in GitHub Desktop.
reg matching..
function import ($filename) {
App::uses('File', 'Utility');
// Set the filename to read from
$filename = TMP . 'uploads' . DS . 'Billing' . DS . $filename;
echo $filename;
// Open the file
$file = new File($filename, FALSE);
$file->open();
// Grab the contents
$contents = $file->read();
// Start parsing for health encounters
preg_match_all('/HEB(.+?)HEE/ism', $contents, $matches);
foreach($matches as $matches_sub) {
foreach ($matches_sub as $match) {
preg_match_all('/HEH(.+?)(?=HEH)/ism', $match, $match1);
debug($match1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment