我正在尝试将此网址与Django / python中的正则表达式匹配(旧的liferay网址)
http://127.0.0.1:8080/documents/34105/35593/prova+(1)+(1).jpg/da459266-ab36-faf1-726d-fc989385b0bd
但我无法解码文件名...
这是我使用的正则表达式:
documents/(?P<repo>[0-9]{5,10})/(?P<folder>[0-9]{5,10})/(?P<filename>[])/(?P<uuid>[\w-]+)
这是Pythex链接
只需使用
documents/(?P<repo>\d+)/(?P<folder>\d+)/(?P<filename>[^/]+)/(?P<uuid>[^/]+)
见证明。
说明
--------------------------------------------------------------------------------
documents/ 'documents/'
--------------------------------------------------------------------------------
(?P<repo> group and capture to (?P=repo):
--------------------------------------------------------------------------------
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
) end of (?P=repo)
--------------------------------------------------------------------------------
/ '/'
--------------------------------------------------------------------------------
(?P<folder> group and capture to (?P=folder):
--------------------------------------------------------------------------------
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
) end of (?P=folder)
--------------------------------------------------------------------------------
/ '/'
--------------------------------------------------------------------------------
(?P<filename> group and capture to (?P=filename):
--------------------------------------------------------------------------------
[^/]+ any character except: '/' (1 or more
times (matching the most amount
possible))
--------------------------------------------------------------------------------
) end of (?P=filename)
--------------------------------------------------------------------------------
/ '/'
--------------------------------------------------------------------------------
(?P<uuid> group and capture to (?P=uuid):
--------------------------------------------------------------------------------
[^/]+ any character except: '/' (1 or more
times (matching the most amount
possible))
--------------------------------------------------------------------------------
) end of (?P=uuid)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句