Regex
Regex is a language that is useful to extract specific data from text into a list of things that are accessible from your Bubble app.
You can use a regex expression in Bubble to extract specific data directly from a text string using the
:extract with regex
operator and is likely the way you will use it most often. However, it can also be quite handy to use within the :find and replace
functionality to identify the text you want to replace rather than typing in a static value. The expressions below should work in both environment.
Expression:
[^\,]+
You may have a text string such at "Juan, Lola, Henry, Felipe, Tonya". Using this regex on this text will convert it into a list of texts which you can then sort, filter, etc in your Bubble app.
Replace the comma above with another character such as a semicolon or space for a list with a different separator.
Sample URL: https://url.com/path1/path2/path3?param1=value1¶m2=value2
Expression:
(?<=
{placeholder}
=)[^\&]+
Replace the placeholder text in the expression with the name of the parameter containing the value you need to retrieve. For example this expression
(?<=param1=)[^\&]+
will return 'value1' from the sample URL.Demo String: myAwesomeImage.jpeg, favoriteVideo.mp4
Expression:
(?<=.)\w{0,4}
Use this expression to extract the extension type from one file or a list of files. Running this expression on the above list of filenames would result in the following list of texts "jpeg, mp4"