Jump to content

Recommended Posts

Posted

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.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • Solution
Posted (edited)

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
Posted (edited)

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
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
  On 7/10/2014 at 7:37 PM, mikell said:

 

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

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
×
×
  • Create New...