-3

i have this :

dir1/
dir1/dir2/
dir1/dir2/dir1/
dir1/dir3/
dir1/dir3/dir1
dir2/dir1/
dir2/dir2/
dir3/

I want regex pattern that matches start with dir1/ and end with after first slash /, result:

dir1/dir2/
dir1/dir3/
mosi_kha
  • 422
  • 5
  • 7

1 Answers1

0

This is what you want:

^dir1\/[^\/]+\/?$

It matches with your desired strings:

dir1/dir2/
dir1/dir3/
Mehdi Mostafavi
  • 851
  • 1
  • 11
  • 23