python - Finding matches in Django model without punctuation or spaces -


i'm trying match string url, field in database same string without punctuation or spaces. example:

url: http://www.mysite.com/johnbsmith/  , string i'm trying match in database is: "john b. smith" 

can regex? 1 catch don't know how many punctuation marks or spaces there be.

how do django? want write in form:

myvariable = mymodel.objects.filter(foo=bar)

thank in advance.

i recommend adding new column table, new field model, maybe slugfield , ensure when save model instance field updated. use purpose django-autoslug.


Comments