Find & Replace with String

I’ve got a paragraph, it’ll be something like…

“Hi, I will speak to <@123456789> about this.” - this is because I am using an API to convert discord messages to string and save to database, so when a user is “mentioned” I get the string output.

I want to replace this <@123456789> string by:

  1. Removing the special characters
  2. Then using the numbers to use an external API (api plugin) to search for this user in discord, and get their username

I understand that I can use regex to remove the characters, and I understand how to use the ID to get the username but I don’t know how to actually get the ID from the string and use it.

Thanks

Hey clifwoodjames, you can use the split-function for this (when you are sure there will be no other < and > characters in the string then the ones related to the user):

  1. Set up:

image

  1. Result:

If there can be more < and > characters in the text you might have to use regex indeed. Using this tutorial and Google it must be possible to extract the user from the string.

2 Likes