Jump to content

What logic to use


shiv
 Share

Recommended Posts

Hi All,

Let us say:

$V = "5.6.7.8"

$M = "current version is 5.6.7.8"

One way to compare both is

"current version is" & $V == $M

and my test will get pass

--------

But i just want to make it more generic, I do not want to concatenate "current version is" with $V.

is there some other way that if i can use some regular expressions in place of "current version is" if yes please elborate how

Thanks

Link to comment
Share on other sites

Try this.

Local $V = "5.6.7.8"
Local $M = "current version is 5.6.7.8"

; $V in $M must be at the start of the line or have a leading space; or,
; $V in $M must be at the end of the line or have a trailing space.
If StringRegExp($M, "(?m)(^|\h)" & $V & "(\h|$)") Then
    MsgBox(0, "Results", "Test Passed")
Else
    MsgBox(0, "Results", "Test Failed")
EndIf
Edit: Removed ".|" out of StringRegExp($M, "(?m)(^|h)" & $V & "(h|.|$)"), because the trailing dot was allowing "5.6.7.8.2" to pass, which is incorrect. Edited by Malkey
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...