Search Patterns From The Text File And If Pattern Missing Place A Value Null
Esteemed colleagues, I have a raw data format as i detailed below where primarily it has to be three line and every line is starts with pattern dn: following ftpuser and descriptio
Solution 1:
Simply make description optional in your regex pattern. Change it to:
r"dn:(.*?)\nftpuser: (.*)\n(?:description:* (.*))?"
Post a Comment for "Search Patterns From The Text File And If Pattern Missing Place A Value Null"