CultureInvariant question

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

I'm trying to understand CultureInvariant as it applies to Regex.

I'd appreciate seeing a string that will be matched by another string when
CultureInvariant is set and not matched when it is not set.

Or the reverse.

I get many Goggle hits but the all assume the reader knows about Culture.

I need to get oriented.

Thanks
 
When I first read it it seemed to me that if I'm comparing strings in a text
editor I need not be concerned about culture because I'm only interested in
equality or not equal. That's true isn't it? If I'm doing case sensitive
comparisons it seems to me the bit are just compared and are either equal or
not.

However, it occurred to me that I don't know how RegEx does case insensitive
comparisons. Does it convert to upper or lower and if it does, does that
make culture important since again, we are just looking for equality.

Thanks

PS
I read the site you suggested and also
Culture-Insensitive String Operations.

But it just makes suggestions about when to use or not use
culture-insensitive string operations. I can't imagine what a
culture-insensitive operation does unless there are some fixed rules that
are applied with out regard to the culture in effect.

If that's the case is "mailto".ToUpper <> "MAILTO" case insensitive equal
even in Turkey?
 
AAaron,

I do not know from what country you are, however be aware that what you read
about cultures on Internet is mostly done by English speaking people from
which a lot think that the whole world is only speaking English.

The culture is in most cases the setting of a computer, you should not set
the culture for a program that is used in different cultures.

If you use a program by instance created in the USA and it would be used in
Canada, then the most stuppid thing you can do is set it to the region CA,
because in Canada is the Brittish (English) and French culture used. The Net
program will automaticly behave like that because it is set like the user in
Canada shows things as he/she is used to.

Cor
 
I don't know how RegEx does case
insensitive comparisons. Does it convert to upper or lower and if it
does, does that make culture important since we are just
looking for equality.

When using RegEx when does it make sense to use CultureInvariant?

Thanks
 
No lower and upper case don't have any thing to do with cultures.

Character Codesets and the way date and times are represented as string is
more where the CultureInfo is for.

While the first is for all west European languages 1251

Cor
 
Back
Top