Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


development:php:regex

Split string using RegEx

$cols=preg_split('/(?<="),(?=")/', trim($row));
// Loop through items
foreach ($cols as $col) {
 echo $col;
}

make sure to add / to the beginning and the end of your RegEx expression

Discussion

Enter your comment:
B W​ X K J
 
development/php/regex.txt · Last modified: 2019/10/31 09:05 (external edit)