I'm trying to preg_split() text between page. I used the following but
can't get the regular expression to work:
$content = blah blah page blah blah blah;
$paged = preg_split( [[:cntrl:]*]page[[:cntrl:]*], $content );
I also tried the following...
$content = blah blah page blah blah blah;
On Thu, Jul 11, 2002 at 06:41:28PM -0400, Monty wrote:
I'm trying to preg_split() text between page. I used the following but
can't get the regular expression to work:
$content = blah blah page blah blah blah;
$paged = preg_split( [[:cntrl:]*]page[[:cntrl:]*], $content );
The * needs to be
The * needs to be after the character class, ie [[:cntrl:]]*.
--Dan
Thanks Dan. But, removing the asterisk or putting it after the character
class doesn't work either for some reason.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Thu, Jul 11, 2002 at 07:33:59PM -0400, Monty wrote:
Thanks Dan. But, removing the asterisk or putting it after the character
class doesn't work either for some reason.
Have you tried [[:space:]]* instead? That'll pull in line breaks, tabs
and spaces.
--Dan
--
PHP
Have you tried [[:space:]]* instead? That'll pull in line breaks, tabs
and spaces.
--Dan
I just tried it, but, still can't make this work. Also, I'm getting
different results between explode() and preg_split(), is that normal? Here's
what I'm trying:
$content = blah blah page_break
On Thu, Jul 11, 2002 at 11:24:34PM -0400, Monty wrote:
$contentpage = preg_split([[:space:]]*page_break[[:space:]]*, $content);
DOH! It's preg!!! [[:space:]] is for ereg. Use \s. I don't know why I
didn't notice sooner. Do this:
'/\s*page_break\s*/'
--Dan
--
PHP
Yes! That was it! Thank you so much. I actually thought preg and ereg were
interchangeable, so, I'm glad you pointed out the difference for reg
expressions. Can you tell me what the open and closing slashes / are for
inside the quotes? Is it equivalent to [ and ] for ereg?
Monty
DOH! It's
On Fri, Jul 12, 2002 at 12:08:36AM -0400, Monty wrote:
expressions. Can you tell me what the open and closing slashes / are for
inside the quotes? Is it equivalent to [ and ] for ereg?
They are delimiters. Other characters can be used, but / is the
standard.
--Dan
--
PHP
8 matches
Mail list logo