caramen Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) @iamtheky since you said that, and you’re trying to help me. I’ m not able to have a critical mind about anything you can say. Dont be afraid and advise me as you want I’m very late with regexp knowledge I will train it a lot at home I guess. Edited April 2, 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...
caramen Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) @iamtheky Wooot man... wow. Hey can you explain me how you're doing to get blank row(?*) without changing the order. *Raw = line does i 'm using the correct word ? Edited April 2, 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...
FrancescoDiMuro Posted April 2, 2019 Share Posted April 2, 2019 @caramen This is what I was meaning: #include <Array.au3> #include <StringConstants.au3> Global $strString = "[BLABLA][Autre][60][Demandeur][4567_987654]" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. : 0607080909" Global $strPattern = "(?is)" & _ "\[[^]]+\]\[([a-z]+)\]\[(\d+)\]\[(Demandeur|Opérateur|Prise|Instructeur)\](?:\[(\w+)?\])?.*?" & _ "Bonjour,\s" & _ "(.*?)(?=vous).*?" & _ "\-\semail\s:\s([^\n]+)\s" & _ "\-\stél\.\s:\s([-\d]+)?" Global $arrResult $arrResult = StringRegExp($strString, $strPattern, $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then _ArrayDisplay($arrResult) Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 2, 2019 Share Posted April 2, 2019 6 minutes ago, caramen said: Hey can you explain me how you're doing to get blank row(?*) without changing the order. Lazy quantifier wit captouring group. Try to remove the [4567_987654] in the string, and you'll see a blank element in the array Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) Daaaaamn Thanks a looot for that clear explanation guys 💗💗💗 Anyway i am very very busy at work i will train this later but i will not miss to do it it is so powerfull and the key to have more powerfull script. Edited April 2, 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...
caramen Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) @FrancescoDiMuro & @iamtheky I did it with that string : And i got a invalid output : [ANAH][PO][31][Demandeur][161560_1550869077] Question technique And the return here : I'm sorry to ask again but the output is wrong i need to use the folder number in external URL after Edited April 2, 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...
FrancescoDiMuro Posted April 2, 2019 Share Posted April 2, 2019 @caramen Show the entire script. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) #include <Array.au3> #include <StringConstants.au3> Global $strString2 = "[BLABLA][Autre][60][Demandeur][4567_987654]" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. : 0607080909" Global $strString3 = "[ANAH][PO][31][Demandeur][161560_1550869077] Question technique" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. :" Global $strString4 = "[BLABLA][Autre][60][Demandeur]" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. : " $aMatch = stringregexp(StringStripWS($strString3 , 8) , "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[*(.*?)\]*?Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z",3) _ArrayDisplay($aMatch) String 3 Edited April 3, 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...
FrancescoDiMuro Posted April 3, 2019 Share Posted April 3, 2019 @caramen There's an error in the pattern. Replace this \[*(.*?)\]*? with this \[(.*?)\] which is the third captouring group. caramen 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 Thx man and have a good day while we're waking up this morning 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...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) Nop 😕 : Or maybe i'm editing the wrong groupe ? Global $strString3 = "[ANAH][PO][31][Demandeur][161560_1550869077] Question technique" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. :" $aMatch = stringregexp(StringStripWS($strString3 , 8) , "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[*(.*?)\]*?Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z",3) _ArrayDisplay($aMatch) And this : = IDEM #include <Array.au3> #include <StringConstants.au3> Global $strString3 = "[ANAH][PO][31][Demandeur][161560_1550869077] Question technique" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. :" $aMatch = stringregexp(StringStripWS($strString3 , 8) , "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[(.*?)\]*?Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z",3) _ArrayDisplay($aMatch) and this : null output #include <Array.au3> #include <StringConstants.au3> Global $strString3 = "[ANAH][PO][31][Demandeur][161560_1550869077] Question technique" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. :" $aMatch = stringregexp(StringStripWS($strString3 , 8) , "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[(.*?)\]Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z",3) _ArrayDisplay($aMatch) Edited April 3, 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...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 You know what your pattern post #3 page 2 is working very fine i ll use this one dont spend more time in this I ll try it and ome back after test if i have one error after multiple test with your code 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...
FrancescoDiMuro Posted April 3, 2019 Share Posted April 3, 2019 @caramen The pattern should be changed from this "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[*(.*?)\]*?Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z" to this "\[.*?\]\[.*?\]\[(.*?)\]\[(.*?)\]\[(.*?)\]Bonjour,([A-Z].+?)([A-Z].+?)vous.*?email:(.*?)-tél.:(.*?)\z" The error was in the captouring group before the "Bonjour" word caramen 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) ahh ok. Thought next line was ok. I know i am still not that pro with AutoIT but i realy feel like a beginner when i start tuching RegExp 😜 Edited April 3, 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...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) @FrancescoDiMuro Bro, Your pattern work fine but nop if i play a bit with my first input line. The @iamtheky Pattern is not working at all with the modification ... arrrrrrrrrf It always work with the text i am provinding but not with the next tests .... Edited April 3, 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...
FrancescoDiMuro Posted April 3, 2019 Share Posted April 3, 2019 3 minutes ago, caramen said: Bro, Your pattern work fine but nop if i play a bit with my first input line. Post ALL the possible texts. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) To be extremly precise on what i can get i ll try again an other shot ^^ . I thought i already did that but ... I notice each time there is a particularity in my nexts attemps. [XXXX][PO][50][Demandeur][161560_1550869077] RANDOM TEXT HERE Bonjour, SURNAME NAME vous envoie ce message : BLABLABLA BLABLABLA BLABLABLA RANDOM AMOUNT OF LINES Coordonnées : - email : AN@EMAIL.com - tél. : 06 YY YY YY YY [XXXX] = Confidential constant name 5 letters [PO] = Can be PO or AUTRE ( or Maybe a random string ?) [50] = Random digit 0 to 999 [Demandeur] = 5 different string possible [161560_1550869077] = Random number in the same format = AAAAA_BBBBB RANDOM TEXT HERE = Random mono line text Bonjour, SURNAME NAME vous envoie ce message = This will never change exept SURNAME NAME And some multiline random text after until point 8. 8.- email : AN@EMAIL.com = "- email : "= constant & Random mail (".fr" , ".com" , ".ZZ" ) 9.- tél. : YY YY YY YY YY = "- tél. : " = Constant & Y = Random number So just to be sure but you already know, I need : -XXXX into a variable -Po into a variable - 50 into a variable -Demandeur into a variable -Folder number into a variable -SURNAME AND NAME into a variable - Email into a variable - Tel into a variable Damn it i dont like to do this it's like i am shoping my code i terrybly sorry about that ... Seem like we have everything here Also I can provide my past working pattern in all my case before the change. $pattern = '(?s).+?(\d+)\]\[([^\]]+).+?Bonjour,\s+(.+?) vous envoie.+?email : (\N+).+?tél. : (\N+)' And that one when i was detecting no phone number : $pattern = '(?s).+?(\d+)\]\[([^\]]+).+?Bonjour,\s+(.+?) vous envoie.+?email : (\N+) But @iamtheky and @FrancescoDiMuro technique is very much better with the lazy parameter So i can have only one pattern and less code Edited April 3, 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...
FrancescoDiMuro Posted April 3, 2019 Share Posted April 3, 2019 (edited) @caramen Now you can experiment whatever you want #include <Array.au3> #include <StringConstants.au3> Global $strString = "[XXXXX][Autre][60][Demandeur][4567_987654]SomeText" & @CRLF & @CRLF & _ "Bonjour," & @CRLF & _ "Charles HENRY vous envoie un message." & @CRLF & _ "J'ai un problème de toilette" & @CRLF & _ "Merci de m'aider" & @CRLF & _ "- email : Jordane.AutoIT@AutoITForum.com" & @CRLF & _ "- tél. : 0607080909" Global $strPattern = "(?is)" & _ "\[([a-z]{5})\]" & _ ; Five Letters "\[(PO|Autre|[^]]+)\]" & _ ; PO or Autre or whatever you want "\[(\d{1,3})\]" & _ ; Three Digits "\[(Demandeur|Opérateur|Prise|Instructeur)\]" & _ ; One of five Strings "(?:\[(\w+)\])?" & _ ; Folder Number, which is OPTIONAL ".*?" & _ "Bonjour,\s" & _ "(.*?)vous.*?" & _ ; Name and Surname "\-\semail\s:\s([^\n]+)\s" & _ ; Email "\-\stél\.\s:\s([-\d]+)?" ; Telephone number, which is OPTIONAL Global $arrResult $arrResult = StringRegExp($strString, $strPattern, $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then _ArrayDisplay($arrResult) Edited April 3, 2019 by FrancescoDiMuro caramen 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted April 3, 2019 Author Share Posted April 3, 2019 (edited) Ok my first attemp is a fail. I will spend you all confidential thing in PM let's see if it s my string that cause problem @mikell Mr pro regexp can you help us 😛 ? Edited April 3, 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 3, 2019 Share Posted April 3, 2019 A hasty try... $strPattern = "(?is)\[([^\]]+)\]\[((?1))\]\[((?1))\]\[((?1))\]\[((?1)).*?Bonjour,\s+(.+?)\hvous.+?email\h:\h(\N+).+?tél.\h:\h(\N+)" 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