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 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. 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? 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] 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 Link to comment https://forums.phpfreaks.com/topic/33545-need-help-with-regex/#findComment-157089 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.