Python String Patterns

I have input: '123Joe amazing login'

What I want to do with this input reminds the user who is registering on the site that he needs to make his username a friendly URL

So, on the server side, I would like to have some string matching or comparison to make sure this is a really friendly URL, and if everything is ok, we are golden, if not, I would like to sign it and send something back to the user like: "Hey this name: 123joes-amazing-login is better"

I'm not too sure where to start looking for any suggestions?

edit:

another io might be: “it's awesome” for “this_is_awesome” etc ... just need to make sure it's friendly!

edit 2: I ended up using this:

username = str(request.form['username'])
username = urllib.quote(username, '')
if '%' in username:

, .

.

+4
2

, , urllib.quote, URL- Python?

+2

pip install python-slugify,

>>> import slugify
>>> username = "123Joe amazing login"
>>> slugify.slugify(username)
'123joes-amazing-login'

, , , .

, . , . URL-, , , . , , , ( ).

+3

All Articles