emexinc Posted January 26, 2010 Share Posted January 26, 2010 ...i can't seem to wrap my head around this... ...i have tried SPLIT, PREG_MATCH, and numerous other methods, only to achieve nothing...i'm trying to create a 'filter' prior to importing data into a database... ...examples... string output one output two xr4004m xr4004 m 4004m 4004 m 4004mi 4004 mi ...i need the letters in front of the numbers (both of which vary in variables) if applicable to be one output string, and i need the letter(s) behind the numbers to be the other output string...i hope this makes sense...thanks...darwin Quote Link to comment https://forums.phpfreaks.com/topic/189818-split-preg_match-etc/ Share on other sites More sharing options...
RussellReal Posted January 26, 2010 Share Posted January 26, 2010 <?php $r = "/^(\w+\d)(\D+)$/i"; preg_match($r,"xyz87612rad",$m); print_r($m); ?> Quote Link to comment https://forums.phpfreaks.com/topic/189818-split-preg_match-etc/#findComment-1001741 Share on other sites More sharing options...
emexinc Posted January 26, 2010 Author Share Posted January 26, 2010 ...thank you...that works quite well... Quote Link to comment https://forums.phpfreaks.com/topic/189818-split-preg_match-etc/#findComment-1001868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.