Reputation: 901
I have a string like this ./this-needs-to-be-matched/knownstring/endofstring
.
I always know that the endofstring is 11 chars long
I have used this until I realized that the - sign will not be matched
\w+\/knownstring\/\w{11}
Now I don't really know how to match any char, including the minus sign.
The result should be: The result should be: this-needs-to-be-matched/knownstring/endofstring
I have also tried:
\.\/.*\/knownstring\/\w{11}
And different other variations so I'm stuck.
Upvotes: 0
Views: 30
Reputation: 425448
Add -
to the list of allowed chars:
^\.\/[\w-]+\/knownstring\/\w{11}$
or just "not a slash":
^\.\/[^\/]+\/knownstring\/\w{11}$
Upvotes: 1