Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function regex_cards( $page = '' )
- {
- $nen = nen_ini();
- $result = '';
- //load card regular expression
- $card_pattern ='/CASE "(?<cardname>_{4}|[a-z][a-z0-9_]{3})"(?:\s*+(?!CASE).*\n)*/m';
- $card_pattern2 = file_get_contents( $nen[ 'root' ]. 'pcre/card data.pattern.pcre' );
- if( $card_pattern !== $card_pattern2 )
- {
- $card_pattern = $card_pattern2;
- }
- unset( $card_pattern2 );
- // assign replacement (unused)
- $card_replace = "$0\n";
- // create desination folder if it does not exist
- if( !is_dir( $nen[ 'root' ]. 'cards out data' ) )
- {
- mkdir ( $nen[ 'root' ]. 'cards out data' );
- }
- // perform current page data regex
- if(
- preg_match_all(
- $card_pattern,
- $page,
- $card_matches
- )
- )
- {
- //foreach($card_matches as $card_key => $card_value )
- //{
- //trk_echo2( 'card', array( 'cardname' => $card_matches[ 'cardname' ], 'card_value' => $card_matches[ 0 ] ) );
- // save creation card collection to file
- file_put_contents( $nen[ 'root' ]. 'cards out data/'. $card_matches[ 'cardname' ][ 0 ]. '.dat', $card_matches[ 0 ][ 0 ] );
- //}
- }
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement