I have been looking for a way to use the SelectLayerByAttribute function to select records in Python based on whether or not one field is a substring of another field. For example, in the table view below, I would want to select the first three records because each of their sub_text strings is contained within the full_text string, or use a NOT version to select the fourth record. I had tried using the LIKE statement (Sub_Text LIKE Full_Text) but functionally it works the same as an = statement and thus selects nothing. So far I've found out how to compare a field to a fixed string within the query, or to see if a string is located at various character positions within the string, but that doesn't really help.
| OID | Full_Text
| Sub_Text
|
|---|
| 1 | thisisaverylongstring | very |
| 2 | thisistrulyanevenlongerstring | longer |
| 3 | thisstringissolongyoucouldmakeasweateroutofit | sweater |
| 4 | idontwantanysubtextinthisstring | really |