0

I have multiple directories with names like app1.6.11, app1.7.12, app1.8.34, test1, test2.

I want to match regex for all the directories which start with app and to exclude app1.8.34.

I have tried:

^(app.+)[^(app1.8.34)]
Community
  • 1
  • 1
Jeet
  • 185
  • 1
  • 2
  • 10

1 Answers1

0

If you want to match just the dot, you should escape it \. it or else it would match any character.

You could use a negative lookahead:

^app(?!1\.8\.34).+$

That would match

^          # The beginning of the string
app        # Match app
(?!        # Negative lookahead that asserts what follows is not
  1\.8\.34 # Match 1.8.34
)          # Close negative lookahead
.+         # Match any character one or more times
$          # End of the string
The fourth bird
  • 154,723
  • 16
  • 55
  • 70