Reputation: 34517
Hi I am reading directories inside one directory. It has names like abcModule and abcRelationModule, xyzModule
I have this regex modules/*/graphql-schema
but it is considering abcModule
, abcRelationModule
, xyzModule
.
I want to exclude abcRelationModule
, which have RelationModule
at the end.
Upvotes: 0
Views: 185
Reputation: 10360
Try this Regex:
modules\/(?![^\/]*RelationModule)[^\/]*\/graphql-schema
Explanation:
modules\/
- matches modules/
literally(?![^\/]*RelationModule)
- negative lookahead to check if the the text RelationModule
is present anywhere before the occurrence of next /
in the directory[^\/]*
- matches 0+ occurrences of any character except /
\/graphql-schema
- matches /graphql-schema
literallyIf you do not want RelationModule
anywhere in the directory, you can simply use ^(?!.*RelationModule).+$
Upvotes: 3