gosu Posted December 14, 2004 Posted December 14, 2004 $line = "Posteingang für <b>hans@test.de</b> (7):" if RegExp($line, "<b>hans@test.de</b> \(\d):", "Test") Then MsgBox(0, "", UBound($Test)) Else MsgBox(0, "", "ERROR!") EndIf $Test is always empty. It matches, but how can I get the value in the brackets? [quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]
gosu Posted December 14, 2004 Author Posted December 14, 2004 ~ [quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]
therks Posted December 15, 2004 Posted December 15, 2004 (edited) gosu said: $line = "Posteingang für <b>hans@test.de</b> (7):" if RegExp($line, "<b>hans@test.de</b> \(\d):", "Test") Then MsgBox(0, "", UBound($Test)) Else MsgBox(0, "", "ERROR!") EndIf$Test is always empty. It matches, but how can I get the value in the brackets?<{POST_SNAPBACK}>I haven't looked into the RegEx stuff yet, but working from my past RegEx experience, I think the problem is with the \ in front of your (. This is telling the function to evaluate it as an actual bracket character, instead of the RegEx command. I think what you want, although I'm guessing here, is something like this:RegExp($line, "<b>hans@test.de</b> \((\d)\):", "Test")This checks for actual bracket characters around a digit character (assuming \d stands for digit). Thus, this will harvest the 7 out of the brackets, leaving you with just the number.*Edit: Added BBCode tags Edited December 15, 2004 by Saunders My AutoIt Stuff | My Github
gosu Posted December 15, 2004 Author Posted December 15, 2004 Saunders said: I haven't looked into the RegEx stuff yet, but working from my past RegEx experience, I think the problem is with the \ in front of your (. This is telling the function to evaluate it as an actual bracket character, instead of the RegEx command. I think what you want, although I'm guessing here, is something like this:RegExp($line, "<b>hans@test.de</b> \((\d)\):", "Test")This checks for actual bracket characters around a digit character (assuming \d stands for digit). Thus, this will harvest the 7 out of the brackets, leaving you with just the number.*Edit: Added BBCode tags<{POST_SNAPBACK}>Thank you very much! I´m new to RegEx. I´ll give you credit in this script when it´s done [quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]
Nutster Posted December 16, 2004 Posted December 16, 2004 gosu said: $line = "Posteingang für <b>hans@test.de</b> (7):" if RegExp($line, "<b>hans@test.de</b> \(\d):", "Test") Then MsgBox(0, "", UBound($Test)) Else MsgBox(0, "", "ERROR!") EndIf$Test is always empty. It matches, but how can I get the value in the brackets?<{POST_SNAPBACK}>The problem is mixing actual parentheses and the grouping parentheses.if RegExp($line, "<b>hans@test.de</b> \((\d+)\):", "Test") ThenThe number (as a string) will be stored in $Test[0].I am currently rewriting the RegExp so that the line would be changed to:$Test = RegExp($line, "<b>hans@test.de</b> \((\d+)\):") If @Error = 0 Then David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
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