learn-regex
learn-regex copied to clipboard
how to give url pattern to search for values like "L76255 - Manual Call Point" . values which contains whitespaces ?
I am making API in django and for that, I need to give a path in URL pattern to match values like
L76255 - Manual Call Point
please help @arxenix @ponsfrilus @loisaidasam
Hi @rishi1804 , can you provide more detail?
So the pattern can be letters, numbers, dashes, and spaces? Any specific order?
Maybe something like:
[\w\-\s]+
(Some amount of alphanumeric characters/hyphens/spaces)
🤷♀️
@loisaidasam yes the pattern can consist of letters, numbers, dashes, and spaces, for example, I need to match values like L76255 - Manual Call Point while making URL patterns in Django
def get_asset_deatils_by_class(request,slug): connections.create_connection(hosts=['localhost'], timeout=20) client = Elasticsearch() s = Search(using=client, index='assets').query("match",class__raw=slug) response = s.execute() list1 = response.to_dict() return JsonResponse(list1)
this is the code and here the slug argument is going to be of the form L76255 - Manual Call Point