Break a multi-line input into a list of inputs

Hi there,

I want my users to paste in a list of email addresses and for bubble to recognise that as a list and create accounts for these addresses. Can’t figure out how to manipulate it. The lists could be long, tens or hundreds, I want to avoid the user inputting it manually. A simple paste and click is as much as I can ask of them.

I know I can do this by getting the user to import a .csv but I want to make this as simple as possible for them. Their eyes generally glaze over if I mention spreadsheets.

Thanks a mill!
Steve.

Hi @stevoster :wave:

You can use regular expression to extract emails out of any text (new line or a paragraph with other texts). This answer helped me to find the best regex for it: javascript - regex extract email from strings - Stack Overflow

See the demo below:
brave_iPA1bgIojy

After extraction, you can do whatever you want with that list. I just displayed them in a repeating group.

Here is the source of the repeating group:

And here is the regex: ([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)

Here you can find the full example: Bubble Demos by Flusk | Bubble Editor

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

2 Likes

Is the list going to be comma separated? or enter separated? If comma separated, just do a split by, if enter separted, use regex to find and replace the enters with commas then do a split by

1 Like

Hey! Thanks a million both of you. @paul29 I used the split by, as you suggest above, but was able to just hit the return key in the ‘split by’ dialogue box and that worked. Superb!

@flusk I initially thought that was too complex for me, but I actually have another use for the example you provided which is so serendipitous!! Looks like Regex is a much more powerful & useful tool than I had thought previously. This opens things up for me.

Anyway, thanks both of you, I really appreciate you taking the time to sort this for me.

Cheers,
Steve.

2 Likes

Hi again. I’m trying out that regex stuff, to see if I can extract info from a long string but can’t get it right. In my test, I am trying to extract the text between ‘Name’ and ‘phen’ of the following text: “First Name: Stephen”
I have used the regex pattern (?<=Name ).*(?= phen)
But it is outputting nothing. SCreenshots might help below. Am I doing something silly here?
I sort of scalped the regex pattern from that website stackoverflow (regex - Regular expression to get a string between two strings in Javascript - Stack Overflow).

Thanks!
Steve.

Screenshot 2024-05-15 at 15.29.22

Screenshot 2024-05-15 at 15.29.28

This pattern ((?<=Name: ).*(?=phen)) extracts Ste out of First Name: Stephen.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

1 Like

That worked!!! I switched out the phen with [\r\n] too - I now have away to paste in my multi line data and peel a set of inputs from the text. Absolutely delighted - thanks so much!

Steve.