Re_Boot Posted December 25, 2010 Report Share Posted December 25, 2010 Sveiciens visiem, man te ir tāda problēma, ka nevaru izdomāt, kā lai uztaisa kodu, kas - [kods:kods] - šajās iekavās visu izdzēš pēc zīmes : un atstāj tikai to kas ir pirms simbola :. Ceru, ka mani sapratāt, varbūt ka tas nav pārāk grūti, bet nespēju neko izdomāt, ar šo funkciju daudz ņēmies. Quote Link to comment Share on other sites More sharing options...
mefisto Posted December 25, 2010 Report Share Posted December 25, 2010 Kaut kas uz šito pusi: \[[\w\d]+:([\w\d]+)\] Ņem un paspēlējies iekš http://www.rexv.org/ Quote Link to comment Share on other sites More sharing options...
marcis Posted December 25, 2010 Report Share Posted December 25, 2010 (edited) Regexp tur nav vajadzīgs. $str = '[kods:kods]'; $str = substr($str, 0, strpos(':')); // paliek tikai tas, kas ir pirms ":" -> "[kods" Edited December 25, 2010 by marcis Quote Link to comment Share on other sites More sharing options...
101111 Posted December 25, 2010 Report Share Posted December 25, 2010 (edited) Piekrītu tam, ka Regexp nevajag izmantot vienkāršām lietam $str = '[kods:kods]'; $x = explode(':', $str); $str = $x[0]; // paliek tikai tas, kas ir pirms ":" -> "[kods" Edited December 25, 2010 by 101111 Quote Link to comment 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.