caramen Posted April 4, 2019 Author Share Posted April 4, 2019 (edited) If i can ask you a last modif @mikell I know it's boring but it's my boss he give me details one after one... not my fault you know me i would give all i can of course... He presented me a string without tel and without field -tel : like this one : $cString4 = "[BLAA][PO][31][Demandeur][1456460_14564567] Question technique "& _ "Bonjour,"& _ "Jordane CARAMEN vous envoie ce message."& _ "Bonjour Dans un précédent message"& _ "Coordonnées :"& _ "- email : mymail@bored.com" I anomised the string and nothing is missing... until my boss does not give me an other option of possibility. OF COURSE before ask i tryed myself... $cPattern = "(?is)\[([^\]]+)\]\[((?1))\]\[((?1))\]\[((?1))\]\[?((?1))?.*?Bonjour,\s*(.+?)\hvous.+?email\h:\h(.+?)" Work but i have one letter added... and no mail $cPattern = "(?is)\[([^\]]+)\]\[((?1))\]\[((?1))\]\[((?1))\]\[?((?1))?.*?Bonjour,\s*(.+?)\hvous.+?email\h:\h" no letter no mail.... I am still trying and will come here if i got a working one zzz this regexp make me so f*** crazy Edited April 4, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
mikell Posted April 4, 2019 Share Posted April 4, 2019 Just suggest to the regex engine an alternation : either the whole "tel" field, or the end of string $cPattern = "(?is)\[([^\]]+)\]\[((?1))\]\[((?1))\]\[((?1))\]\[?((?1))?.*?Bonjour,\s*(.+?)\hvous.+?email\h:\h(.+?)(?:[\s-]+tél\.\h:\h(.+)?|$)" caramen 1 Link to comment Share on other sites More sharing options...
caramen Posted April 4, 2019 Author Share Posted April 4, 2019 (edited) @mikell I am in the engine... I tryed start string to end string starting point after : But fail ater fail since 45 minutes... i try that and come in 1 min I dont have the mind for that.... I ll rep+ all your regexp post and will try to learn by following you. Perfect... Merci. Edited April 4, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
mikell Posted April 4, 2019 Share Posted April 4, 2019 2 hours ago, caramen said: He presented me a string without tel and without field -tel Hmm. Next time there will be the -tel/-tel field , but no -email/-email field ... probably. So let's anticipate : $cPattern = "(?is)\[([^\]]+)\]\[((?1))\]\[((?1))\]\[((?1))\]\[?((?1))?.*?Bonjour,\s*(.+?)\hvous.+?(?:email\h:\h(.*?))?(?|[\s-]+tél\.\h:\h(.*)?|()$)" Note that with this one, the array is always 7 elements. If the required info is missing, the row is left empty caramen 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now