(\.*/)*(?<capturegroup>.*)
The first group matches a number of points, followed by a slash, an unlimited number of times; the second group is what interests you. This will separate your slash, so add a slash.
Remember that this absolutely does not confirm that your leading line of slashes and periods is not something plainly stupid. However, it will not remove leading points from your path, as an obvious pattern ([./])* for the first group; it finds the longest chain of dots and slashes that ends with a slash, so it wonโt hurt your real path if it starts with a dot.
Keep in mind that the obvious "/". The ltrim () strategy will strip leading points from directory names, which is bad if your first directory is completely plausible, because leading points are used for hidden directories.
source share