belick Posted January 10, 2007 Share Posted January 10, 2007 I have a set of char that always stats with numbers and end with letters like: 23112Adfafdwafas, and I need to saperate it into two varibles like:$Set1 = the numbers$Set2 = the charectersThanks ahead Quote Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/ Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 There is a regex forum. Quote Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/#findComment-157040 Share on other sites More sharing options...
magic2goodil Posted January 10, 2007 Share Posted January 10, 2007 wth is Regex? Quote Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/#findComment-157051 Share on other sites More sharing options...
genericnumber1 Posted January 10, 2007 Share Posted January 10, 2007 [quote author=magic2goodil link=topic=121731.msg501029#msg501029 date=1168398592]wth is Regex?[/quote]regular expressions....and even though it's in the wrong board I'll answer...[code=php:0]<?php$chars = '23112Adfafdwafas';preg_match('/([0-9]+)([a-zA-Z]+)/', $chars, $split);list(, $numbers, $letters) = $split; // this isn't a typo, you dont want to include the first value so you should start with a commaecho $numbers . ' | ' . $letters; // echos '23112 | Adfafdwafas'?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/#findComment-157054 Share on other sites More sharing options...
magic2goodil Posted January 10, 2007 Share Posted January 10, 2007 before i got confused on what regex was, i was thinking preg_match would work beautifully Quote Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/#findComment-157089 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.