PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > Troubleshooting

Reply
 
Thread Tools
Old 12-10-2004, 02:45 AM   #1
Jad
Green Mole
 
Join Date: Sep 2004
Location: Amman
Posts: 4
Warning: ereg_replace(): REG_EBRACK in .....

Greetings
I'm getting this error while spidering
Warning: ereg_replace(): REG_EBRACK in /full/path/to/libs/phpdig_functions.php on line 231

$text = ereg_replace('(['.$phpdig_words_chars[$encoding].'])[\'._~@#$:&%/;,=-]+
($|[[:space:]]$|[[:space:]]['.$phpdig_words_chars[$encoding].'])','\1\2',$text);

I have replaced ereg_replace with str_replace and it works fine
now phpDig works fine, but why it was giving errors with ereg_replace?
Jad is offline   Reply With Quote
Old 12-10-2004, 12:19 PM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
If you set your encoding to iso-8859-1, then you should crawl pages with the same encoding. It is not advisable to replace ereg_replace with str_replace! Try the below test.
PHP Code:
<?php
error_reporting
(E_ALL);
$text "abc 123 '\"._~@#$:&%/;,=- [abc] AÀÁÂÃÄÅ [123] ðþßµ";
define('PHPDIG_ENCODING','iso-8859-1');
$phpdig_words_chars['iso-8859-1'] = '[:alnum:]ðþßµ';
$encoding PHPDIG_ENCODING;
$text ereg_replace('[^'.$phpdig_words_chars[$encoding].' \'._~@#$:&%/;,=-]+',' ',$text);
$text ereg_replace('(['.$phpdig_words_chars[$encoding].'])[\'._~@#$:&%/;,=-]+($|[[:space:]]$|[[:space:]]['.$phpdig_words_chars[$encoding].'])','\1\2',$text);
echo 
$text// prints abc 123 ' ._~@#$:&%/;,=-  abc  A   123  ðþßµ
?>
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 12-11-2004, 09:57 PM   #3
Jad
Green Mole
 
Join Date: Sep 2004
Location: Amman
Posts: 4
hmm I can understand but the problem, I'm crawling sites with different encoding, I have tried to use UTF-8 (I though I first that phpDig Convert and store data to the selected encoding )
but it didnt work fine, and same with other encoding
what to do when I have to crawl sites with different encoding ?
Jad is offline   Reply With Quote
Old 12-11-2004, 11:58 PM   #4
vinyl-junkie
Purple Mole
 
Join Date: Jan 2004
Posts: 694
Quote:
Originally Posted by Jad
what to do when I have to crawl sites with different encoding ?
The only thing you can do is change the encoding each time you want to crawl a different site. It's a pain, I know, but it will work for you.
vinyl-junkie is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: ereg_replace(): REG_EBRACK alivin70 Troubleshooting 3 02-23-2005 08:41 AM
Warning clearwater Troubleshooting 1 01-02-2004 08:31 PM
Warning: .... foreach() isto Troubleshooting 3 12-23-2003 04:03 PM
Requested Warning Charter The Mole Hole 0 11-28-2003 05:14 AM
I got a warning, please help David J Harmon Troubleshooting 6 09-29-2003 05:36 PM


All times are GMT -8. The time now is 11:15 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.