Fix for 1140

Proposed solution from #1140

Replaces `CaptureNodeWithLiteral.cs`

Builds a regular expression based on the segment. And then parses the route segment with the built regex.