I need help creating a regular expression.
Here are two sample strings:
/path/to/file.jpg
/path/to/file.type.jpg
Respectively, I’m trying to capture:
file.jpg
file.type.jpg
But I want to capture the three as separate strings.
file,jpg
file,type,jpg
Note that I’m not capturing the periods.
I thought something like this could work (excluding the new lines):
([a-z]+)\.
[([a-z]+)[\.]{1}]?
([a-z]{3})
Guidance would be appreciated.
I’m wondering if there is another modified I would need to use to have it capture it properly.
The above expression errors out, by the way 🙁
I suggest you to use pattern
and you will have 3 groups: file, type (which will be empty, if not present) and extension