Jump to content

[SOLVED] Regex for #-


Matrixkid

Recommended Posts

Hi there,

 

I have a string that looks like this;

2-Name,3-Name,4-Name,5-Name,6-Name,7-name

 

Im trying to preg_split the string into an array so that all im left with is name,

I can remove the comma no problem once its split up

 

I have tried the following:

 

$array_name = preg_split("/[0-9][-]/",$names);
$array_name = preg_split("/[0-9-]/",$names);
$array_name = preg_split("/[0-9]-]/",$names);

 

Thanks for your help!

Cheers

MK

Link to comment
https://forums.phpfreaks.com/topic/159303-solved-regex-for/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.