Re: preg_split

From: Date: Mon, 11 Dec 2000 15:24:24 +0000
Subject: Re: preg_split
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29688@lists.php.net to get a copy of this message
Thomas Holton wrote: > > sorry, the first email had a couple of errors in it, this is the correct > one. > > Hi, > I am getting a confusing error message when i try to do the following: > > i have a string, read from a file: > 1234 <a href="#1234> 4321 </a> e- 1231 > > it is succesfully read in the var, $inp[$ix] using the file cmd: > $inp = file("infile.txt"); > > i want to divide this string up into two vars, splitting the string at the > <a tag, like this: > > $s_arr = preg_split('<a',$inp[$ix]); > $s_arr = preg_split('/<a/',$inp[$ix]) ^ ^ you have to use pattern match delimiters. Don't have to be /, but most common. It was reading < as the first delim. Mike D.

« previous php.general (#29688) next »