0

I am trying to comeup with a regex to skip all the subfolders inside "node_modules" of the angular section

So far I tried it out with the following expression but I am unsure if this would be correct

  ^(.*)?\/?node_modules\/(?:(.*)?[\/]?)

  1) ^- asserts start of the line
  2) .*- matches any charactes
  3) Grouping 1 (.*)? - returns zero or one time the matching group (so 
      it will return if there are any number of characters present)
  4) [\/] matches the "/" character
  5) [\/]? returns if there are zero or one / character
  6)  *node_modules* -  matches the entire string
  7) \/ - matches the  "/" character
  8) Non matching group (?:)
  9) (.*) - groups any number of characters
  10) (.*)? - returns zero or one matching the group
  11) [\/]? - return zero or one matching "/" character

Now will this regex be valid for these expressions

test/node_modules/ test/node_modules/@test/test test/node_modules/test/test/test test/node_modules/test/test/test/test test/node_modules/test/test/test/test/test

Please let me know how to validate these and if my regex needs to be modified

vijayakumarpsg587
  • 1,079
  • 3
  • 22
  • 39

0 Answers0