I’m trying to create a basic search term highlight function without relying on fuzzy searches or similar and the best I can come up with is a :find & replace. This makes the text matching the search term bold and red for visibility, the search itself is performed in the data source.
The search is performed in an RG and across multiple fields that cannot be condensed into one.
My current approach works, but is case sensisitive.
I’m led to believe that Regex is a good solve for this, but I know nothing about Regex and am struggling to get it working.
(?i) I believe should negate case sensitivity, but that just makes the entire text disapper.
Can anyone steer me in the right direction please?
AFAIK, Bubble does not support capture group references in the replace property.
@QIRO, try sharing here your full find and replace expression, and somebody might have an idea to streamline it.
For example, if you’re currently searching for every combination of upper and lowercase letters so that you can replace the entire found string with itself enclosed in bbcode, then you might instead be able to use regex’s lookaround and word boundary features to instead find and replace just the single characters (e.g., space, punctuation) that immediately precede and follow your search term.
(\W|^)(?=\b(search|Search)) finds the non-word character or beginning of line immediately preceding any of the search terms concatenated with the | alternator delimiter.
(?<=(search|Search)\b)(\W|$) finds the non-word character or end of line immediately following any of the search terms concatenated with the | alternator delimiter.