Jump to content

What is the best way to check for 3 pieces of text in a string?


Go to solution Solved by jguinch,

Recommended Posts

Hi, im struggling with this issue, StringInStr could do the trick, but it doesn't seem to support 3 different strings to compare, StringRegExp is messy, i tried some ways, help was no help, so i hope you can.

So this will exemplify what i need:

$StrDropCheckFolder = StringInStr($__aGUIDropFiles[$i], ".mp3;.wav;.wma", 2)

Anything that contains those = true

I made the StringRegExp work, but only with one string at a time.

Couldn't find in help file the corresponding OR parameter.. and OR doesn't work in StringInStr.

Best regards.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Solution

Something like this ?

Local $aFiles[] = [ "1.mp3", "2.txt", "3.wav", "4.wma", "5.doc"]
For $i = 0 To UBound($aFiles) - 1
    If StringRegExp($aFiles[$i], "(?i)\.(?:wav|mp3|wma)$") Then ConsoleWrite($aFiles[$i] & @CRLF)
Next
Edited by jguinch
Link to comment
Share on other sites

Hi, thank you all, it is exactly that, now i've been looking at the help file, and what "czardas" posted is what is called a "Non-capturing group with reset" yes?

and what "jguinch" posted is a "Non-capturing group", have to be honest, i've seen them in the help file, but didn't have a clue it was what i was looking for.

Also im trying to understand what is what, and i've used (?i) to make whats next to it case in-sensitive, but why is "." this used between it and the grouped items?

About the $ at the end.. help file says: "Outside a character class, the dollar matches at the end of the subject text, and also just before a newline sequence if option (?m) is active."

So, like a final dot in a sentence? :P

Thanks

EDIT: after looking at it again, it seems the trailing backlash represents whats before the dot, and the dot, represents the extension dot, and is where it is, because it is common to the text in the group.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

 

About the $ at the end of the pattern, just try this with and without the $  :)

$str = "test.mp3.bak"
Msgbox(0,"", StringRegExp($str, "(?i)\.(?:wav|mp3|wma)$") )

Yes, with it, it only searches the last bit, without it, searches all. Thank you

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...