Member Avatar for ___150

Hi,This code creates a friendly link on user mentions in comments...

However, it is not case sensitive and vice versa.

Examples;

@test works
@Test doesn't work

The regular expression takes both values. But the query is not catching. I figured it would be a case-sensitive collation on the database. But I am using utf8_general_ci (users) & utf8_unicode_ci (comments)... I tried changing it to utf8mb4_bin, but it's still the same. The same (user mentioned) only because of a lowercase / or uppercase letter it doesn't work ;/
What do I do?

But the query is not catching.

What do you expect the query to return?

Member Avatar for ___150

I want you to return the same @test is the same as @Test (regardless of letters)

Sorry if my english is bad... I don't understand your language very much (using translator)

Ok. I assume, then, that usernames are unique, correct? In other words, if a user exists with the username test, another user cannot have the username Test.

This will require you to normalize your users table and store username in all lowercase as a UNIQUE value. When a new user wishes to register their username, you will compare it to existing usernames to prevent duplicates.

But that presents another problem. In another post, you asked for help capitalizing the first letter of username. If you normalize username to all lowercase, your users will not be able to have compound usernames (e.g., @JamesTheGreat will be converted to @Jamesthegreat). Of course, one way to go about using compound usernames is to save them with underscores, where JamesTheGreat is saved to the database as james_the_great. That will force you to add another layer of conversion, ideally at the database level, but I guess you will cross that bridge when you get to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.