Advertisement
jargon

MR97-ProcGen Vars Capture Regex

Dec 17th, 2021
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function vars_rip( $subject = '' )
  2. {
  3. $nen = nen_ini();
  4.  
  5. $pagedata = '';
  6.  
  7. $subject=file_get_contents($nen['root'].'source/MR97 ProcGen Core.bas');
  8. $pattern = '/(?<var>([A-Za-z][A-Za-z0-9]*))(\$|\!|\&|\#|\%|)/';
  9. $match_count=preg_match_all($pattern, $subject, $matches );
  10.  
  11. trk_echo2('match', $matches);
  12.  
  13. for ( $index = 0; $index < $match_count; $index++ )
  14. {
  15. if( strlen( $matches[ $index ][ 1 ] ) > 0 )
  16. {
  17. $pagedata.= '<tr><td>'. $matches[ $index ][ 1 ]. '</td></tr>';
  18. }
  19. }
  20.  
  21. if( strlen( $pagedata ) > 0 ){
  22. $pagedata = '<table>'. $pagedata. '</table>';
  23. }
  24. return $pagedata;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement