Extract multiple strands with regex [solved]

Hello all! I have a super simple question as I am new to “extract with regex”. I was just wondering how I would go about extracting multiple strands as I am trying to make a command system. The user would type in a strand like: “/me sample” and it would upload to a database field and come back as text using “extract with regex” allowing “samle” to be shown without “/me”

If someone could help me, as I know it is possible. That would be much appreciated. Thanks in advance!
-Whitigol

Hi @whitetigerwolfthe1st,

You haven’t really said what the exact rules are which is obviously important in regex. But if you perhaps are saying you want to separate a string on every space, then use this expression:

([^\s])+

The result will be a list, so you can grab one or any of the items depending on what you need.

If you are actually looking for some other rule to be followed, then just let me know what it is, and I’d be happy to work it out for you.



Looking to accelerate your app development?

Let me turn
:thinking: :tired_face: :confounded:

into
:grinning: :sunglasses: :woman_student:

Development through Coaching at https://uniqueideas.com or schedule a free intro session :gift:

Ken Truesdale
LinkedIn

@mebeingken
Okay, I will explain more of what I mean.

This is my first time using regex in my bubble applications. I am currently developing a CAD/MDT System for my PS4 Roleplay Server that is ran in discord.

I am trying to make a command system for in game interaction. For example, when a user calls 9-1-1, they will type in the command center in the cad system "/911 reason". After that, they would click enter.

It would then trigger a webhook in the discord server allowing dispatch to see (in the discord server) that a certain user called 9-1-1. When the user types in the command. The workflow will send the webhook with the command that the user entered in to the field. But I am trying to get rid of the “/911” when the webhook is sent so the users viewing the message do not see it. To achieve this, after the text I am using “find and replace” using a regex pattern. I am trying to get it to remove the commands /me, /911, /twotter, and more. I have seen this done in other places. I was just wondering how I could achieve this myself.

Okay, try this. Modify the original string with :extract with regex :trimmed where the regex expression is:

\s(.*)

Technically this is giving you everything after the first space within a string, so that space after /nnn is required.

1 Like

Okay, thank you. I will try that and get back to you!

Works perfectly! Thank you so much!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.