On Sat, 16 Dec 2006 07:29:59 -0600, Bergamot put finger to keyboard
and typed:
>cristina wrote:
>>
>> If your question is about the use of hyphens - in URLs,
>> I think it was a time when it was better to use underscores _ instead
>
>AIUI, search engines tend to treat words separated by hyphens as
>separate words, and words separated by underscores as a single compound
>word.
That's a side-effect of search engines being originally programmed
using standard regular expressions, in which the underscore is a word
character (along with all the letters and numerals), while all other
punctuation (including a hyphen) are non-word characters. So anything
that searches for word boundaries will find one in between the
sections of "foo-bar", but won't find a boundary in "foo_bar".
I tend to use plus signs as separators in URLs (particularly when
using mod_rewrite to read parseable URLs rather than using GET
variables). That's partly because a plus sign is a valid and correct
URL replacement for a space anyway, but it also avoids confusion with
words that are genuinely hyphenated and need to remain hyphenated in
the URL (such as double-barrelled names, and hypenated words like
"double-barrelled"!).
>Developers probably tend to favor underscores because most programming
>languages don't allow hyphens as a word separator for variable or
>function names. It's just a habit to use underscores.
More to the point, hyphens *are* a word separator in most programming
languages (just as they are in regular expressions, and for the same
reason), but variable names usually have to be a single word. So
programmers use underscores to create the visual appearance of
multiple words in a string that is actually only one word as far as
the language compiler/interpreter is concerned.
Mark
--
Visit:
http://www.MotorwayServices.info - read and share comments and opinons
"Well it's true today"