javascript regex for extracting filename from Content-Disposition header

后端 未结 6 1533
忘掉有多难
忘掉有多难 2021-01-11 11:58

Content-disposition header contains filename which can be easily extracted, but sometimes it contains double quotes, sometimes no quotes and there are probably some other va

6条回答
  •  隐瞒了意图╮
    2021-01-11 12:36

    Slightly modified to match my use case (strips all quotes and UTF tags)

    filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?

    https://regex101.com/r/UhCzyI/3

提交回复
热议问题