JoeBar 1 Posted November 11 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 ! Share this post Link to post Share on other sites
Danp2 567 Posted November 11 Try doubling up on the double quotes inside the string, like this -- Local $regex = "[\w"" "":\/%\.']+" Hide Danp2's signature Hide all signatures [UDF] WebDriver (W3C compliant) Latest version Share this post Link to post Share on other sites
JoeBar 1 Posted November 11 Good solution, thanks for your fast answer ! Share this post Link to post Share on other sites
jchd 1,285 Posted November 12 (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 by jchd Hide jchd's signature Hide all signatures 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) Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 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. Share this post Link to post Share on other sites
mikell 888 Posted November 14 StringRegExpReplace($txt, '(?<=;)\h+', "") Share this post Link to post Share on other sites
jchd 1,285 Posted November 14 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) Hide jchd's signature Hide all signatures 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) Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 (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 by JoeBar Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 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. Share this post Link to post Share on other sites
abberration 39 Posted November 14 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! Hide abberration's signature Hide all signatures RAID Calculator | Software InstallerThe truth has been suppressed since the dawn of time. Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 (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 by JoeBar Share this post Link to post Share on other sites
abberration 39 Posted November 14 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. Hide abberration's signature Hide all signatures RAID Calculator | Software InstallerThe truth has been suppressed since the dawn of time. Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 (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 by JoeBar Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 (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 by JoeBar Share this post Link to post Share on other sites
Nine 342 Posted November 14 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. Hide Nine's signature Hide all signatures No signature so far... Share this post Link to post Share on other sites
JLogan3o13 1,515 Posted November 14 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. Hide JLogan3o13's signature Hide all signatures √-1 2^3 ∑ π, and it was delicious! How to get your question answered on this forum! Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 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. Share this post Link to post Share on other sites
JoeBar 1 Posted November 14 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. Share this post Link to post Share on other sites
JLogan3o13 1,515 Posted November 14 (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 by JLogan3o13 Hide JLogan3o13's signature Hide all signatures √-1 2^3 ∑ π, and it was delicious! How to get your question answered on this forum! Share this post Link to post Share on other sites