Two dataframes with phone numbers with ids that could only be matched via regex, e.g.
| idPrefix | other columns |
|---|---|
| 420 | |
| 42055 | |
| 420551 |
| phoneNumber | other columns |
|---|---|
| 420551666 | |
| 421709560 |
I would need to join these dataframes on the best match of idPrefix to the phoneNumber, matching the longest starting prefix possible, if there is one. E.g. if there were any option to join on longest idPrefix for phoneNumber.startswith(idPrefix), that would be great.
I tried a few UDFs with regex instead of a df.join(), but there does not seem to be a way to have a dataframe as an input to UDF.
