JoeBar Posted November 11, 2019 Share Posted November 11, 2019 Hi, i know that's a stupid question, but i cannot format a correct Regex declaration (although the regex is good in itself) : Local $regex = "[\w" ":\/%\.']+" I have a problem with the double-quotes and/or with the space in middle of regex. Thanks ! Link to comment Share on other sites More sharing options...
Danp2 Posted November 11, 2019 Share Posted November 11, 2019 Try doubling up on the double quotes inside the string, like this -- Local $regex = "[\w"" "":\/%\.']+" Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
JoeBar Posted November 11, 2019 Author Share Posted November 11, 2019 Good solution, thanks for your fast answer ! Link to comment Share on other sites More sharing options...
jchd Posted November 12, 2019 Share Posted November 12, 2019 (edited) AutoIt string literals can use either single or double quotes as delimiter. Also your character class pattern uselessly includes twice the double quote; dot isn't special inside a character class and finally slash isn't special either (despite the common use of / to delimit patterns in Perl and many other environments: the regex functions know that the parameter is a pattern). You still have to double the single quote (in bold red below) for AutoIt to parse the string correctly Hence you can write your pattern like this: Local $regex = '[\w ":/%.'']+' or, equivalently, using double quotes as string delimiter and doubling the embedded one (in bold green below): Local $regex = "[\w "":/%.']+" Edited November 12, 2019 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 On 11/12/2019 at 2:55 AM, jchd said: AutoIt string literals can use either single or double quotes as delimiter. Also your character class pattern uselessly includes twice the double quote; dot isn't special inside a character class and finally slash isn't special either (despite the common use of / to delimit patterns in Perl and many other environments: the regex functions know that the parameter is a pattern). You still have to double the single quote (in bold red below) for AutoIt to parse the string correctly Hence you can write your pattern like this: Local $regex = '[\w ":/%.'']+' or, equivalently, using double quotes as string delimiter and doubling the embedded one (in bold green below): Local $regex = "[\w "":/%.']+" The double quote were here for a space (didn't know a simple space would match), so no double quote is needed inside the RegEx. I can't delete \ before / and . or it doesn't recongnize the litteral characters. In fact i don't need % too. My RegEx is : [\w :\/\.'-]+ , but i would want to not include spaces after the ";" , i join an example of my file : Quake3; https://test-site.com/Quake.jpg; Welcome to QUAKE 3 Arena!; https://test-site.com:5001/sharing/jjherqg CS1.6; https://test-site.com/cs16_cover.jpg; C'est le grand classique; https://test-site.com:5001/sharing/kllfdsbg Sven co-op; https://test-site.com/sven_cover.jpg; Half Life en COOP; https://test-site.com:5001/sharing/dfgdfgdfg Chivalry; https://test-site.com/chiv_cover.jpg; Paulo dans le dos; https://test-site.com:5001/sharing/hbrfhgdhg My goal is to delete the annoying spaces between ";" and all strings. I do it with RegExReplace after RegEx, but if you could show me how to do it in one simple RegEx, that would be nice ! Thanks. Link to comment Share on other sites More sharing options...
mikell Posted November 14, 2019 Share Posted November 14, 2019 StringRegExpReplace($txt, '(?<=;)\h+', "") Link to comment Share on other sites More sharing options...
jchd Posted November 14, 2019 Share Posted November 14, 2019 3 hours ago, JoeBar said: I can't delete \ before / and . or it doesn't recongnize the litteral characters. Untrue: ConsoleWrite(StringRegExpReplace("abc/def//ghi.jkl", "[/.]", "_") & @LF) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 (edited) 35 minutes ago, jchd said: Untrue: ConsoleWrite(StringRegExpReplace("abc/def//ghi.jkl", "[/.]", "_") & @LF) So RegEx in Autoit is different from PCRE, for example Regex101. I thought it was the same engine. Where can i find the differences between them ? Edited November 14, 2019 by JoeBar Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 4 hours ago, mikell said: StringRegExpReplace($txt, '(?<=;)\h+', "") I do StringRegExpReplace ("(^\s+)", "") after my Regex and i have the good formatting. ---> My 1st regex puts the elements in an array and the StringRegExpReplace removes blanks before elements. I just asked if i could do this with just a simple Regex without the StringRegExpReplace. I don't understand your formulation. Link to comment Share on other sites More sharing options...
abberration Posted November 14, 2019 Share Posted November 14, 2019 I can't believe you guys haven't caught that this thread involves something the rules prohibit. I was going to say something earlier, but I thought the thread was over and didn't want to stir up stuff. Welcome to QUAKE 3 Arena! Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 (edited) It's for doing a loader for LAN games in private, we own games etc .... We have an http server to distribute games, it's just that. What is the problem ? Edited November 14, 2019 by JoeBar Link to comment Share on other sites More sharing options...
abberration Posted November 14, 2019 Share Posted November 14, 2019 Gaming automation is forbidden. Here is the forum rules: Look at the first point, the 4th bullet point: Quote Launching, automation or script interaction with games or game servers, regardless of the game. Sorry. From what I understand, gaming talk in the past led to lots of anger on the forum. Personally, I don't like game cheaters. I play an online game and got bulldozered because the opponent was obviously cheating. Don't be a cheater. There's no glory in that. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 (edited) Ok i found the answer : StringRegExp ;*\s*([\w :\/\.'-]+) , it does what i want with a simple RegEx Thanks for your help. Edited November 14, 2019 by JoeBar Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 (edited) 6 minutes ago, abberration said: Gaming automation is forbidden. Here is the forum rules: Look at the first point, the 4th bullet point: Sorry. From what I understand, gaming talk in the past led to lots of anger on the forum. Personally, I don't like game cheaters. I play an online game and got bulldozered because the opponent was obviously cheating. Don't be a cheater. There's no glory in that. Are you serious ? This script is just used to download a list of files with a GUI on an owned server at home. It never aims at automate any game or what, LOL cheating in 2019. Stop drugs. Edit : If you want, i show you the full code, you will seem shameful ... Edited November 14, 2019 by JoeBar Link to comment Share on other sites More sharing options...
Nine Posted November 14, 2019 Share Posted November 14, 2019 Joe, take a small moment to breath. He is not attacking you. He is just remembering you of the rules...You are asking for help, so consider the ppl investing time to answer you. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 14, 2019 Moderators Share Posted November 14, 2019 1 hour ago, JoeBar said: If you want, i show you the full code, you will seem shameful ... Whether it is "shameful" or not, showing all your code will help others help you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 2 minutes ago, Nine said: Joe, take a small moment to breath. He is not attacking you. He is just remembering you of the rules...You are asking for help, so consider the ppl investing time to answer you. Sorry if i was rude (don't know the word, i'm not english), but i found talking about Cheat just with my examples exagerated. I like the idea of sharing knowledge and i hope it will go on. Link to comment Share on other sites More sharing options...
JoeBar Posted November 14, 2019 Author Share Posted November 14, 2019 Just now, JLogan3o13 said: Whether it is "shameful" or not, showing all your code will help others help you. My problem is solved with the only elements provided but if you ever want, just ask me and i will. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 14, 2019 Moderators Share Posted November 14, 2019 (edited) Now that I have read through the topic further, it appears @abberration was correct in pointing you the rules. The forum rules state we do not support automation of games OR their servers, whether these are owned by you or a third party. Thread locked, feel free to PM me if you would like to discuss further. Edited November 14, 2019 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts