There are working regExp: '^modules(/.*|$)',
How I can change it to exclude such paths as 'modules/../../ .types. ' ?
If you need to exclude file extensions, it can be done two quick ways.
If using the old JS regex engine (no lookbehind asserts):
^modules(/(?:(?!\.(?:ext1|ext2|ext3)[ \t]*$).)*|)$
https://regex101.com/r/fJFIPL/1
^ modules
( # (1 start)
/
(?:
(?!
\.
(?: ext1 | ext2 | ext3 )
[ \t]* $
)
.
)*
|
) # (1 end)
$
If using the new JS regex engine (variable lookbehind asserts):
^modules(/.*(?<!\.(?:ext1|ext2|ext3)[ \t]*$)|)$
https://regex101.com/r/wAlrNW/1
^ modules
( # (1 start)
/ .*
(?<!
\.
(?: ext1 | ext2 | ext3 )
[ \t]* $
)
|
) # (1 end)
$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.