Jump to content

RegExp - Not matching?


Recommended Posts

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

  • Developers

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

  • Developers

Match also after crlf = (?s)

Start matching the fixed string = Result for circuit

match any character = (.*?)

until dot is found = \.

Jos :(

Edited 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...