View Single Post
Old 02-22-2013, 12:05 PM   PM User | #4
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 574
Thanks: 15
Thanked 64 Times in 64 Posts
Arcticwarrio is on a distinguished road
This works for all the variants you gave.

and also "coding forums_245.54.3"

PHP Code:
<?php

if(isset($_POST['gamecode'])) {
  
$txt=$_POST['gamecode'];

  
$re1='((?:[a-z][a-z]+))';    # Word 1
  
$re2='.*?';    # Non-greedy match on filler
  
$re3='((?:[a-z][a-z]+))';    # Word 2
  
$re4='.*?';    # Non-greedy match on filler
  
$re5='(\\d+)';    # Integer Number 1
  
$re6='.*?';    # Non-greedy match on filler
  
$re7='(\\d+)';    # Integer Number 2
  
$re8='.*?';    # Non-greedy match on filler
  
$re9='(\\d+)';    # Integer Number 3
  
$re10='.*?';    # Non-greedy match on filler
  
$re11='(\\d+)';    # Integer Number 4
  
$re12='.*?';    # Non-greedy match on filler
  
$re13='(\\d+)';    # Integer Number 5

  
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8.$re9.$re10.$re11.$re12.$re13."/is"$txt$matches))
  {
      
$word1=strtoupper($matches[1][0]);
      
$word2=strtoupper($matches[2][0]);
      
$int1=$matches[3][0];
      
$int2=$matches[4][0];
      
$int3=$matches[5][0];
      
$int4=$matches[6][0];
      
$int5=$matches[7][0];
      
$cleangc "$word1$word2-$int1$int2$int3$int4$int5 \n";
  }
  
} else {
$cleangc "None";
}
echo 
$cleangc;
?>
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Users who have thanked Arcticwarrio for this post:
bemore (02-22-2013)