Shorten TripAdvisor Restaurant Review URL

For this sort of thing you are looking for patterns you can use. More samples are better for that.

From just the one, the "KM action" version of @ComplexPoint's JavaScript split would be:

image

If you think the -s are a more reliable splitter you could do:

image

...which looks really verbose, but is nothing more than "take the first three - delimited items and join them together with a -.

And there's the ever-fun RegEx version of the same:

image

1 Like