Hi, I need to split up a string like this A99B99C99E99F05G05H02N99P04Q99R99S02T10U04U05V99W03Z03 into A99,B99,C99,E99,F05,G05,H02,N99,P04,Q99,R99,S02,T10,U04,U05,V99,W03,Z03 So Every Third Character I need to break up with some type of delimiter. Is there an Easy way to do this? Thank you
This will do the trick: $text = 'A99B99C99E99F05G05H02N99P04Q99R99S02T10U04U05V99W03Z03'; $deliminator = "-"; $text = preg_replace( '/[A-Z0-9]{3}/i', "$0$deliminator", $text); $text = preg_replace( "/$deliminator$/", "", $text); PHP: The second statement removes trailing deliminators.