PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   Indexing of numbers (http://www.phpdig.net/forum/showthread.php?t=1918)

jerrywin5 03-13-2005 10:04 PM

Indexing of numbers
 
Is it possible to index only phone numbers as in:

###-###-####
or
###-####
or
(###) ###-####
or
###.###.####
or
###.####

and not index other sets of numbers such as dates, times, dolar amounts, and misc. numbers?

I am lost when it comes to regular expressions.

Charter 03-15-2005 09:29 AM

Perhaps modify the following line in robot_functions.php to insert words or telephone numbers:
Code:

// v.1.8.7
        if (strlen($key) > SMALL_WORDS_SIZE and strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]) and ereg('^['.$phpdig_words_chars[PHPDIG_ENCODING].'#$]',$key))

// v.1.8.8 RC1
        if (mb_strlen($key) > SMALL_WORDS_SIZE and mb_strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]))

Note though that PhpDig uses a space to separate 'words' so telephone numbers like "(xxx) xxx-xxx" for example might need to be considered near the $separators = " "; line in the robot_functions.php file.

jerrywin5 03-16-2005 08:37 AM

Thanks. I don't know how to work with regular expressions nor how to add one to this line of code. SInce this sounds like a complex issue to deal with, how can I keep from indexing all numbers?

Charter 04-06-2005 01:08 PM

Try the following and see if it avoids all numbers:
Code:

// v.1.8.7
        if (!eregi("[0-9]",$key) and strlen($key) > SMALL_WORDS_SIZE and strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]) and ereg('^['.$phpdig_words_chars[PHPDIG_ENCODING].'#$]',$key))

// v.1.8.8 RC1
        if (!mb_eregi("[0-9]",$key) and mb_strlen($key) > SMALL_WORDS_SIZE and mb_strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]))



All times are GMT -8. The time now is 11:17 PM.

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