Welcome Guest, Not a member yet? Register   Sign In
Help with stripping value from return string
#4

[eluser]kb1ibh[/eluser]
if there is no dash, and the solution above doesnt work, could you post some examples of these letter-number-letter combinations?


Edited to Add:
if there are no dashes, This might work... Havent had a chance to test it, but i dont think i made any serious errors

Code:
$string = YOUR_LETTER_NUMBER_LETTER_STRING;

preg_match("/([a-zA-Z]+)([0-9]+)([a-zA-Z]+)/", $string, $matches);

echo "part 1: " . $matches[0] . "\n";
echo "part 2: " . $matches[1] . "\n";
echo "part 3: " . $matches[2] . "\n";

It should work with both A1A and AAAAAA11111111AAAAAAAA, no matter how long the string is


Messages In This Thread
Help with stripping value from return string - by El Forum - 04-04-2012, 08:12 AM
Help with stripping value from return string - by El Forum - 04-04-2012, 09:10 AM
Help with stripping value from return string - by El Forum - 04-04-2012, 11:44 AM
Help with stripping value from return string - by El Forum - 04-04-2012, 12:41 PM
Help with stripping value from return string - by El Forum - 04-05-2012, 03:56 AM
Help with stripping value from return string - by El Forum - 04-05-2012, 04:00 AM
Help with stripping value from return string - by El Forum - 04-05-2012, 08:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB