Dec 14, 2022 03:46 AM - edited Dec 14, 2022 08:50 AM
I'm trying to detect overlaps between my records and display data from the respective other records they're overlapping with, but am struggling yet again with creating the right regular expression for the REGEX_EXTRACT.
Currently I'm...
IF(List,REGEX_EXTRACT(
List&"",
"(?:" & SUBSTITUTE(Identifier,".", "\\.") & ")([^,]*)"
)
)
Result:
Identifier | Data | List (rollup/arrayojoin of Data fields) | Desired output |
2022-06-13-Bashkim Memia-Host | 2022-06-13-Bashkim Memia-HostNikson: 12 pers +1 | 2022-06-13-Bashkim Memia-HostNikson: 12 pers +1,2022-06-13-Bashkim Memia-HostNedih: 2 pers +1 | Nedih: 2 pers +1 |
2022-06-13-Bashkim Memia-Host | 2022-06-13-Bashkim Memia-HostNedih: 2 pers +1 | 2022-06-13-Bashkim Memia-HostNikson: 12 pers +1,2022-06-13-Bashkim Memia-HostNedih: 2 pers +1 | Nikson: 12 pers +1 |
Thanks for your help!
Dec 14, 2022 06:44 AM
@Ricardo , hi! You may try the following formula:
SUBSTITUTE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(Overlap,"("& Data &")",""),"("& ID &")",""),"(^,)|(,$)",""),",,",",")
I assumed all the fields as single line text, so you will need to add '&"' to ensure strings. Also, the rollup field (Overlap) can have unlimited entries. Hope this helps.
Dec 14, 2022 09:17 AM
Thanks @Andrey_Kovalev!
The innermost REGEX_REPLACE errors on the Overlap, which is a lookup of the rolled up / ARRAYJOIN(values) of the Data fields, I edited my post for clarify, I probably misplained something. After modifying the formula to Overlap&"" (for string) it gets going.
REGEX_REPLACE(Overlap&"","("& Data &")","")
Any idea what I could be doing wrong here?
Dec 14, 2022 09:32 AM
Ensure the Data is a string also, attach '&""'.
Dec 14, 2022 10:09 AM
I tried and it didn't work, this is where I got stuck. 😕
The "Overlap" (Data rollup) actually includes all and not just overlapping records. This is why I initially used the REGEX_EXTRACT together with Identifier to select relevant ones.
The final formula would be a combination of both, removing its own string from the roll-up, extracting all occurrences with matching IDs and then continuing to remove Identifier strings to get the desired output.
Dec 14, 2022 10:19 AM
If you give more sample data I could try to search for a solution.
Dec 14, 2022 10:37 AM
Thanks for the offer. I'm not sure what's the best way to share data. I synced some sample data into a shared view. Does this do the trick?