Can a preg_split be accompished with a forwardslash as the seperator. I just tried a test from the PHP Manual and couldn’t get anything to work. (I am trying to split a URL at the slashes)
$keywords = preg_split("/[\\s,]+/", "hypertext language, programming");
changed to..
$keywords = preg_split("/[/]+/", "hypertext language/ programming");
I tried a couple other things but couldn’t get them to work.
Nevermind. I was just missing a backslash.
$keywords = preg_split("/[\\/]+/",
"hypertext language/ programming");
gdtrfb
February 15, 2005, 6:59pm
3
I believe you don’t even need that, just use a different character for your starting and ending delimiters. I haven’t tested this, but it should work:
$keywords = preg_split("X/+X", "hyptertext language/ programming");
worth a shot.
sweatje
February 16, 2005, 12:58am
4
For a single character, preg_split is using a sledge hammer to swat a fly.
try:
$result = explode('/', 'hyptertext language/ programming');
HTH
toggg
February 16, 2005, 1:08am
5