How do i get the part before the vertical bar in a string

Hey Devs, i’m 100% sure this is possible, how can i get the part behind the vertical bar using string.match?

image

This should be in #help-and-feedback:scripting-support

But string.split(str, " | ")[1] would get everything before the vertical bar.

1 Like

I want to use string.match though how can i do that?

You could use string.match(str, ".* |"), but it will include the vertical bar in the output…

I believe you can solve this with captures:
string.match(str, "(.*) |")


You can also get the thing before and after the vertical bar in one go using captures:

1 Like