Closed BabyElias closed 1 year ago
I would like to work on this issue :)
Hi @BabyElias , you can go ahead and propose a fix for this , thanks
@Avi-88 So I have come up with a regex that will declare names having punctuations,emojis and numericals as invalid, while accept letters of any language as input. Will that suit our purpose?
Cool, the invalid parts are right imo. Not sure about different languages though. Special characters - yes , but entirely different language - not sure. Any suggestions @leecalcote ?
Perhaps:
var re = /^[A-z脌-鸥\s\d-]*$/g;
var str1 = 'casa-me,pois 99 estou farto! Eis a lista:uma;duas;tr锚s';
var str2 = 'casa-me pois 99 estou farto Eis a lista uma duas tr锚s';
var str3 = '脿猫矛貌霉脌脠脤脪脵谩茅铆贸煤媒脕脡脥脫脷脻芒锚卯么没脗脢脦脭脹茫帽玫脙脩脮盲毛茂枚眉每脛脣脧脰脺鸥莽脟脽脴酶脜氓脝忙艙'
alert(re.test(str1));
alert(re.test(str2));
alert(re.test(str3));
more on this subject here - https://stackoverflow.com/questions/1073412/javascript-validation-issue-with-international-characters
Perhaps:
var re = /^[A-z脌-鸥\s\d-]*$/g; var str1 = 'casa-me,pois 99 estou farto! Eis a lista:uma;duas;tr锚s'; var str2 = 'casa-me pois 99 estou farto Eis a lista uma duas tr锚s'; var str3 = '脿猫矛貌霉脌脠脤脪脵谩茅铆贸煤媒脕脡脥脫脷脻芒锚卯么没脗脢脦脭脹茫帽玫脙脩脮盲毛茂枚眉每脛脣脧脰脺鸥莽脟脽脴酶脜氓脝忙艙' alert(re.test(str1)); alert(re.test(str2)); alert(re.test(str3));
more on this subject here - https://stackoverflow.com/questions/1073412/javascript-validation-issue-with-international-characters
This includes if not all, then a majority of international languages. So, I guess if we want to validate the names in known languages, it will work well. Should I go ahead with it @Avi-88 ?
Hi @BabyElias , sorry for the delayed response.The above mentioned one also allows numbers and whitespace , /^[A-z脌-鸥'-]+$/g
this one should deny any whitespace or numbers while allowing almost all accented letters as well. I've checked it for some names but still would suggest testing some more incase I missed anything. If everything worksout you can go ahead with it , thanks
Okay! Thank you so much :)
[A-Za-z沤啪脌-每]{1,32} This is the final regex that I have come up with. Accounts for almost all the international characters check that I performed. Generating PR for the same
@Avi-88 This is the regex that I have finally come up with ([A-Za-z沤啪脌-每]+('[A-Za-z沤啪脌-每])?[A-Za-z沤啪脌-每]){1,32}|[[A-Za-z沤啪脌-每] |[A-Za-z沤啪脌-每]+'{0,1}
Its a combination of 3 regexs, if any of it match to the format of our name entered, they are considered valid. First regex :[A-Za-z沤啪脌-每]+('[A-Za-z沤啪脌-每])?[A-Za-z沤啪脌-每]){1,32} Checks if a single apostrophe is not present at the end of or beginning but somewhere in between Second regex: [A-Za-z沤啪脌-每] The first regex should have ideally considered single characters entry as valid, but if I enter just "o" or any single character, it considers it invalid, so to check single characters, we have this regex Third regex :[A-Za-z沤啪脌-每]+'{0,1} If someone has their name as O'Reily, they might consider O' as their first name and Reily as last. So this regex checks if a single apostrophe is present at the end of the string (This check will only be applied to first name field and not last)
And these regexes also check for presence of accented characters, as needed originally
Woah, that's huge! thats's what she said (sorry couldn't help it). Umm , I get the first 2 , but i don't think the 3rd one applies. Names with apostrophe are considered as whole and aren't split into O'
and Reily
. Other than that I don't have any issue with it, but could you clarify why we can't go with a much smalller regex /^[A-z脌-鸥'-]+$/g
this one instead, it's not that I want you to use what I suggested but just curious if there are advantages to using this over the other one. You can go ahead with the updated change, thanks
The regex that you have mentioned doesn't match the condition that we have just one quotation mark, and also doesn't check if that quotation mark is present in between and not at the beginning or end. And I'll remove the third regex then and add the regex to both first and last names.
Also, if we go for [A-z] this will also include the characters between Z & a which are operators like So, we cannot go for [A-z] and have to break it as [A-Za-z]
Got it, good work @BabyElias :)
Current Behavior
As mentioned by Lee on Slack, there's a bug in the Name field of signup form that requires users to enter the name in a specific format.
Expected Behavior
We can either remove the check since name need not follow a specific format OR make it more inclusive to include all languages
Environment
Contributor Guides and Resources