Sign in to follow this  
Followers 0
Steveiwonder

RegExp - Not matching?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Match also after crlf = (?s)

Start matching the fixed string = Result for circuit

match any character = (.*?)

until dot is found = \.

Jos :(

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0