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)]
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)]
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:
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