Jump to content

What logic to use


Recommended Posts

Hi All,

Let us say:

$V = ""

$M = "current version is"

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


Link to comment
Share on other sites

Try this.

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

; $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")
    MsgBox(0, "Results", "Test Failed")
Edit: Removed ".|" out of StringRegExp($M, "(?m)(^|h)" & $V & "(h|.|$)"), because the trailing dot was allowing "" 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

  • Recently Browsing   0 members

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