Pauletp Posted February 1, 2009 Share Posted February 1, 2009 I have a string"G3A B2 G2|A2 G2 B2 G2|G3A B2 G2|A2 G2 E4|G3A B2 G2|A2 G2 B2 d2|G3A G2 E2|E2 D2 D4"In the tutorial on regular expressions in the Help file there is a GUI (StringRegExpGUI.au3) to test results with StringRegExpIf I input the search string in the GUI to be ([abcdefgABCDEFG]3[abcdefgABCDEFG] [abcdefgABCDEFG]2 [abcdefgABCDEFG]2)the GUI shows the result array to be0 => G3A B2 G21 => G3A B2 G22 => G3A B2 G23 => G3A G2 E2This is the result I want.But the code #Include <Array.au3> $Source = "G3A B2 G2|A2 G2 B2 G2|G3A B2 G2|A2 G2 E4|G3A B2 G2|A2 G2 B2 d2|G3A G2 E2|E2 D2 D4" $Filter = "([abcdefgABCDEFG]3[abcdefgABCDEFG] [abcdefgABCDEFG]2 [abcdefgABCDEFG]2)" $MatchArray = StringRegExp($Source, $Filter,1) _ArrayDisplay ($MatchArray, "Display matches")only displays the first match which is"G3A B2 G2" so the syntax must be wrong.Many thanks if someone has a tip. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 1, 2009 Moderators Share Posted February 1, 2009 StringRegExp($Source, "(?i)([a-g]3[a-g] [a-g]2 [a-g]2)", 3) Note the "3" in the 3rd parameter. You're only telling it to find the first match. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now