PDA

View Full Version : Indexing of numbers


jerrywin5
03-13-2005, 10:04 PM
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:

// 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:

// 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]))