Regex to match string ending with string or nothing

Viewed 2707

I want to match strings ending with javascript encoded characters (%20, %u200E, etc) or end of line.

I've got this regex: (/\w*?)*(?=(%\w{2,}|[\s/])) which matches /text part in these:

/text
/text
/text%20
/text%u200E

But doesn't matches anything in this: /text (no character at end, not even new line)

1 Answers
Related