[PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty

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;
$paged = preg_split( [:cntrl:]page[:cntrl:], $content );

...and...

$content = blah blah page blah blah blah;
$paged = preg_split( [[:cntrl:]]page[[:cntrl:]], $content );

But none of these work. Can someone tell me what's wrong? I just want to
split the text on page and include any line feeds that may have been put
in before or after the page text.

Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions

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 after the character class, ie [[:cntrl:]]*.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty

 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




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions

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 classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty

 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 blah blah blah blah;
  $contentpage = preg_split([[:space:]]*page_break[[:space:]]*, $content);

But I just get a PHP error: Warning: Unknown modifier '*' in testme.php

If I try this:

  $content = blah blah   page_break blah blah blah blah;
  $contentpage = preg_split([[:space:]]page_break[[:space:]], $content);

I get this PHP error: Warning: Unknown modifier 'p' in testme.php

I'm not sure what I'm doing wrong with the reg exp, but, it won't even
parse. Both expressions above used with explode() only produce empty array
variables, as though it's stripping out everything.

What am I doing wrong?

Monty


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions

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 classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty

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 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions

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 classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php