For example from the list of these files:
- payload1.json
- payload1.result.json
- payload1.details.json
- payload2.json
- payload2.result.json
- payload123.json
- payload123.result.json
- payload123.details.json
- randomfile.gotincluded.byaccident.json
- payload-001.json
- some_data_for_processing.json
It should only return payload1.json, payload2.json, payload123.json, payload-001.json, and some_data_for_processing.json while ignoring everything else. Thanks!
CodePudding user response:
^[a-zA-Z0-9_-] .[a-zA-z0-9] $
This will capture only the ones you want from that list.
^ : start of string
[ : beginning of character group
a-z : all characters a-z case sensitive
A-Z : all characters A-Z case sensitive
0-9 : all characters 0-9
_ : underscore
- : dash
] : end character group
: one or more of the character group
. : require a single .
[ : beginning of character group
a-z : all characters a-z case sensitive
A-Z : all characters A-Z case sensitive
0-9 : all characters 0-9
] : end character group
: one or more of the character group
$ : end of string