I have this regular expression :
new RegExp("[a-zA-Z]{1}[/]{1}" + userName + "[/]{1}[a-zA-Z0-9-_]+$", "i")
This provides me much of my required results. However I am unable to check one condition:
I do not want my last character to be '-'. It could be present anywhere after second '/', just not the last character. More precisely last character should be anything [a-zA-Z0-9_]
but not a hyphen '-'.
I checked out this, but could not wrap my head around it. How is this done exactly.