need php preg code to force certain username format

Hello

I have a wordpress website in which indeed membership pro plugin has provided register & login form.

via preg codes in plugin’s php file, we have forced certain username format as following :

usernames must be in this format :
(left)minimum 3 characters . (right)minimum 3 characters ( means first name then a dot and then last name )

we forced above format via following php code:

[php]if (!preg_match('/^[a-zA-Z]{3,1000}+([.][a-zA-Z]{3,1000})$/', $value)){
			  $return = $register_msg['ihc_register_error_username_msg'];
		
			}	[/php]

I need another line of preg “if” code to force the plugin to check if both sides of dot are the same (means if the firs name & last name are entered exactly similar), system returns the error.
for example if a user tries to create his username as john.jonh , system doesn’t accept and shows error
thanks in advanced

What about people who have less than 3 characters in their first/last names?

Worth a read http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

no worry about that.
we are not English and in my country all first names or last names have at least 3 characters

so would you please give me the code ?

We don’t believe in, “just give me the code”.

Now, what you can do is show us what you have attempted.

Checking if two strings are exact is trivial. Split on the period.

Sponsor our Newsletter | Privacy Policy | Terms of Service