Uncategorized

Python Regex: Unable to Find A Solution For Searching With A Specific Text For Multiple Variations Of Texts


I was expecting to get “abc” and “cba”, which are unknown values (they are always placed in that format, “:abc:cba”).

only if it finds the word “trr” (“trr” always will be behind “:abc:cba”), but sometimes “trr” leaves a copule of unknown characters or/and symbols behind or/and in front, for example:

  1. unknown_values_trr:abc:cba
  2. trr_unknown_values:abc:cba
  3. unknown_values_trr_unknown_values:abc:cba

I made a couple of variations of texts that could be shown up and what the expected results were:

  1. “abc://trr/txx:abc:cba” | Found | “abc”, “cba”
  2. “trr/txx:abc:cba” | Found | “abc”, “cba”
  3. “abc://trr:abc:cba” | Found | “abc”, “cba”
  4. “trr:abc:cba” | Found | “abc”, “cba”
  5. “abc://xee/txx:abc:cba” | Not Found
  6. “xee/txx:abc:cba” | Not Found
  7. “abc://xee:abc:cba” | Not Found
  8. “xee:abc:cba” | Not Found



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *