Jump to content

Recommended Posts

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

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 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 here
RegExp tutorial: enough to get started
PCRE 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
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
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 here
RegExp tutorial: enough to get started
PCRE 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
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

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!

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

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 by JoeBar

Share this post


Link to post
Share on other sites

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.


RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post


Link to post
Share on other sites

Ok i found the answer : StringRegExp ;*\s*([\w :\/\.'-]+) , it does what i want with a simple RegEx

 

Thanks for your help.

Edited by JoeBar

Share this post


Link to post
Share on other sites
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 by JoeBar

Share this post


Link to post
Share on other sites
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
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

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 by JLogan3o13

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...