正则表达式匹配Django项目中URL pattarns中使用的字母和数字组合?

时间:2021-11-05 18:05:52

I need to pass username in my URL. username can be any combination of letter, numbers and special characters like @,_. also, username starts with a letter.

我需要在我的网址中传递用户名。用户名可以是字母,数字和特殊字符的任意组合,如@,_。此外,用户名以字母开头。

username examples: test@1, test_1,test2_1990,

用户名示例:test @ 1,test_1,test2_1990,

1 个解决方案

#1


0  

You can use this regex for your purpose: "^[a-zA-Z][a-zA-Z0-9_@]*$"

您可以将此正则表达式用于您的目的:“^ [a-zA-Z] [a-zA-Z0-9 _ @] * $”

#1


0  

You can use this regex for your purpose: "^[a-zA-Z][a-zA-Z0-9_@]*$"

您可以将此正则表达式用于您的目的:“^ [a-zA-Z] [a-zA-Z0-9 _ @] * $”