Start a new topic
Answered

Dictionary to remove an unneeded end to a string

Trying to import event IDs, but the platform we're using won't allow multiple entries with the same ID.


Thus I'm wanting to take something that'd turn both "EVENTID1718/A" and "EVENTID1718/B" into plain "EVENTID1718". 


Not every ID will have that sort of suffix, but I can change what the split is if needed.


Suggestions?


Best Answer
This is assuming that your string is always alphanumeric and a forward slash always be the delimeter. If so you could use some regex that looks something like this:

Replacement values:   $1
Value to match on:   (\w+)\/(\w+)

This looks for any length alphanumeric string split by a forward slash. It then returns only group 1;  everything before the slash


Answer
This is assuming that your string is always alphanumeric and a forward slash always be the delimeter. If so you could use some regex that looks something like this:

Replacement values:   $1
Value to match on:   (\w+)\/(\w+)

This looks for any length alphanumeric string split by a forward slash. It then returns only group 1;  everything before the slash


1 person likes this

The string will always be alphanumeric, and basically the delimeter is whatever I want it to be, as all our digital team need is that they can put a different ID in for each event, so /A /B /C etc seemed the easiest way of giving them that but letting me easily remove it.

Just checked it and it looks like it works, thank you very much!


Best,


John

Login or Signup to post a comment