PHP Code:
<?php # URL that generated this code: # http://txt2re.com/index-php.php3?s=slus_123.45&2&-22&3&-16&4
$txt='slus_123.45';
$re1='((?:[a-z][a-z]+))'; # Word 1 $re2='(_)'; # Any Single Character 1 $re3='(\\d+)'; # Integer Number 1 $re4='(\\.)'; # Any Single Character 2 $re5='(\\d+)'; # Integer Number 2
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5."/is", $txt, $matches)) { $word1=strtoupper($matches[1][0]); $c1=$matches[2][0]; $int1=$matches[3][0]; $c2=$matches[4][0]; $int2=$matches[5][0]; print "$word1-$int1$int2 \n"; }
#----- # Paste the code into a new php file. Then in Unix: # $ php x.php #----- ?>
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Last edited by Arcticwarrio; 02-22-2013 at 10:19 AM..
|