Reputation: 24766
Environment: Windows 7 + XAMPP for Windows 5.6.15
I need to search a folder for sub-folders that match one of the pattern from these two
E*.mysoftware.swl.px64
E*.r*.mysoftware.swl.px64
So these are the set of sub-folders I need to select
E0234.mysoftware.swl.px64
E0235.mysoftware.swl.px64
E0236.mysoftware.swl.px64
E0236.r2.mysoftware.swl.px64
E0237.mysoftware.swl.px64
E0237.r2.mysoftware.swl.px64
E0237.r3.mysoftware.swl.px64
These shouldn't select
E0237.A.mysoftware.swl.px64
E0237.b3.mysoftware.swl.px64
My question is can I do this search by using only one pattern?
Upvotes: 1
Views: 58
Reputation:
What you are trying to do is make the .r*
part optional which I have done using the following regex.
Regex: E\d*(\.r\d*)?\.mysoftware\.swl\.px64$
Flags used:
g
for global search.
m
for multi-line search.
Explanation:
(\.r\d*)?
this makes the .r*
part optional, thus facilitating searches of both patterns in one regex.Upvotes: 3
Reputation: 2557
Try this
(E[\w]+.mysoftware.swl.px64)|(E[\w]+.r[\w]+.mysoftware.swl.px64)
https://regex101.com/r/qG4iT4/1
Hope this helps.
Upvotes: 1