How to discard the last sentence if it's incomplete

How to discard the last sentence from a text if it’s incomplete (i.e. doesn’t end with a full stop, exclamation mark, etc.)?

Probably can do it using regex but I’m a total idiot when it comes to regex.

Any other simpler way? Thanks.

You can use the command “ truncated-from-end-to” to analyze the last letters…

https://manual.bubble.io/core-resources/data/operations-and-comparisons#truncated-from-end-to

1 Like

Hi @rpetribu but i’ll need to know the where the last full-stop is. Bubble doesn’t seem to have anything like a indexOf() function?

Hi @jayy !

Could you give us an example with more details?

Hi @rpetribu

In the end I got someone to help me write a regex. But good to know more about Bubble’s string handling capabilities.

Example text:

In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may

My goal is to truncate the last incomplete sentence " Lorem ipsum may".

To use the command truncated from end to, I need to know how many characters to truncate (i.e. 16).

How do I get this number 16? There’s no command to help me find out where’s the last full stop, how many characters are after the full stop, etc.

Hi @jayy !

Ohhh, now I understood the problem…

I don’t think Bubble can do it alone. You willl need to extrat with regex (as you did) or use a bit of javascript… Glad you found a solution :wink:

1 Like

Thanks! So it seems that learning regex is an essential part of Bubble :sweat_smile:

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