简体   繁体   English

C# 正则表达式匹配动态 Html 文档中的文件名

[英]C# Regex Match Filenames in dynamic Html Document

I've this kind of urls in a html document我在 html 文档中有这种网址

  1. /assets/sdluxdczm3ee4000/ /资产/sdluxdczm3ee4000/
  2. /assets/sdluxdczm3ee4000 /资产/sdluxdczm3ee4000
  3. assets/sdluxdczm3ee4000/资产/sdluxdczm3ee4000/
  4. assets/sdluxdczm3ee4000资产/sdluxdczm3ee4000

I want to match -> sdluxdczm3ee4000 , to get out all filenames in whole html document.我想匹配 -> sdluxdczm3ee4000 ,以获取整个 html 文档中的所有文件名。 Is there a way to write a regex to match only this cases?有没有办法编写一个正则表达式来匹配这种情况?

The closest I've got to solution is: \\bassets\\w*(.+)$ and (?=assets\\b)\\w+我最接近的解决方案是: \\bassets\\w*(.+)$(?=assets\\b)\\w+

这样的事情应该工作:

\\/?assets\\/\\w+\\/?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM