poe Posted November 12, 2006 Share Posted November 12, 2006 i will have a string that is for sports scores and is shown as:outcome(w,l,t,so,nd) team score : opp scoreso it would look like:[a-z] [0-9] : [0-9]ie. w14:3OR l16:21OR so4:3OR t6:6 etc...i want to add a `:` after the outcomeie.. w:7:3how do i add a : after the alpha charactert(s) Quote Link to comment Share on other sites More sharing options...
sinisake Posted November 12, 2006 Share Posted November 12, 2006 Can be done on this way:[code]<?php$stringi="w14:3";$patern="^[a-z]+";if(eregi($patern,$stringi,$match)){$match=implode("",$match);$replace=$match.":";$stringi=eregi_replace($match,$replace,$stringi);echo ($stringi);}?>[/code] 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.