Steveiwonder Posted March 20, 2010 Share Posted March 20, 2010 Hey all, I'm a little stuck on this one, it doesnt seem to be matching. This is an example, The text will always start "Result for circuit" then followed by anything including whitespace and new lines but always ends with a "." which is where the match should stop. I may be missusing(?s) im not sure but it won't work. $text = "Result for circuit JEPC123456" & @CRLF & "this is the result and could be antyhign@:@~@}{}=-=." $regexp = StringRegExp($text, "Result for circuit([A-Z]*[0-9]*)(?s)\.") ; match "Result for circuit If $regexp Then msgbox(0,"Match", "Match found") EndIf Any help is appreciated. Thanks. S They call me MrRegExpMan Link to comment Share on other sites More sharing options...
Developers Jos Posted March 20, 2010 Developers Share Posted March 20, 2010 Maybe?: $text = "Result for circuit JEPC123456" & @CRLF & "this is the result and could be antyhign@:@~@}{}=-=." $regexp = StringRegExp($text, "(?s)Result for circuit(.*?)\.") ; match "Result for circuit ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $regexp = ' & $regexp & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console If $regexp Then msgbox(0,"Match", "Match found") EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Steveiwonder Posted March 20, 2010 Author Share Posted March 20, 2010 Why and how do you make it look so easy >.< but thanks, it works. I now need to udnerstand it, so i'll get my head down and keep working. They call me MrRegExpMan Link to comment Share on other sites More sharing options...
Developers Jos Posted March 20, 2010 Developers Share Posted March 20, 2010 (edited) Match also after crlf = (?s) Start matching the fixed string = Result for circuit match any character = (.*?) until dot is found = \. Jos Edited March 20, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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