oMBRa Posted September 4, 2008 Posted September 4, 2008 I found this example in the autoit help ;Option 1, using offset $nOffset = 1 While 1 $array = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd but I didnt get what means (.*?)... any1 help?
weaponx Posted September 4, 2008 Posted September 4, 2008 . - Match any single character (except newline). * - Repeat the previous character, set or group 0 or more times. Equivalent to {0,} ? - The previous character, set or group may or may not appear. Equivalent to {0, 1}
Szhlopp Posted September 4, 2008 Posted September 4, 2008 I found this example in the autoit help ;Option 1, using offset $nOffset = 1 While 1 $array = StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 1, $nOffset) If @error = 0 Then $nOffset = @extended Else ExitLoop EndIf for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 1 - " & $i, $array[$i]) Next WEnd but I didnt get what means (.*?)... any1 help? StringRegExp('<test>a</test> <test>b</test> <test>c</Test>', '<(?i)test>(.*?)</(?i)test>', 1, $nOffset) The pattern looks for what ever is between <test> and </test> (.*?) basically means it's going to stop at the next character in the sequence. Remove the '?' and all of the sudden your result is: a</test> <test>b</test> <test>c So it's going to grab ANY character '.' It's going to repeat it '*' UNTIL '<' Help clarify it for you? RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+'
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