[英]REGEX to get the elements from the image filename
I need to parse a set of filenames with the next pattern: 我需要使用下一个模式解析一组文件名:
A0001L+23.20K+01-Red.JPG A0001L + 23.20K + 01-Red.JPG
Into the followed elements: 分为以下元素:
I'm using the the approach of REGEX groups using the next pattern: 我使用下一个模式使用REGEX组的方法:
IMAGE_PATTERN = "[A-Z](\\d\\d\\d\\d)[A-Z][-|\\+](\\d\\d\\.\\d\\d)[A-Z][-|\\+](\\d\\d)-([A-Za-z]+)(\\.[A-Za-z]+)";
But is not working correctly, is the IMAGE_PATTERN, set it right? 但是无法正常工作,IMAGE_PATTERN是否设置正确?
I have tested below pattern and it works: 我已经测试了以下模式,它的工作原理:
[a-zA-Z]([0-9]{4})L\+([0-9\.]+)K([+\-][0-9]+)\-([a-zA-Z]+)
You can modify it to suit your needs. 您可以对其进行修改以适合您的需求。
You may check out the below link 您可以查看以下链接
I think you are after this, includes fetching +/- as well 我想您是在这之后,还包括提取+/-
[a-zA-Z](\d{4})[A-Z]([+\-]\d{2}\.\d{2})K([+\-][0-9]+)\-([a-zA-Z]+)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.