multilineinput input value:split by()
then inside the split is just a line break
it works fine and I get a list of separated by paragraphs
but what I need is instead of being separated for every line break, what I need is it should be separated for every 3rd line break so I get a list of 3 paragraph chunks
Easiest way if it is possible is to format your initial value to have some kind of separated to split by…if it is not possible as the initial value comes from other sources outside of your control, the approach is a bit convoluted as it would require nested RGs to first split the original text, and then in nested rg to group them in chucks of three using items from items until with some math formula incorporating the parent rg cell index number.
I had an idea, try it out: Find and replace with regex:
find → (.[asterisk]\n.[asterisk]\n.[asterisk])(\n)
replace → $1#$2
then split by: #
(I had to write [asterisk] because 2 * makes it italic
so just substitute [asterisk] by *)
(the find will search for a set of 3 paragraphs, and insert a # after these 3 paragraphs)
(you can use another symbol if you want, ex: §§§ (and split by §§§)
This is definitely a scenario for regex, and I love a good regex challenge. I independently tried a few ideas that didn’t work well. Here’s what I came up with following consultation with ChatGPT.
@rccanlas, note that the technique of first replacing and then splitting, as other posters described, accounts for the possibility that the total number of paragraphs is not a multiple of 3. You could instead try Bubble’s :extract with Regex operator, but the regex expression would be more complicated, or perhaps impossible, to allow for the final extracted item being just 1 or 2 paragraphs instead of 3.
I wasn’t aware that, as noted by @ri_scc_94 and ChatGPT, Bubble’s :find & replace operator’s option to use a regex pattern supports regex, such as capture group references, in the “Replace by” text. @fede.bubble, that’s worth explaining in the operator’s entry in Bubble reference documents, which doesn’t even mention the operator’s regex option at all.