Forum Discussion

Rafael_Fradczyk's avatar
Rafael_Fradczyk
Occasional Contributor
9 years ago

regular expressions in property checkpoint

Hi everybody,   I have an issue with regular expression in property checkpoints. I want to compare a string. In this string there's the current daytime. So to compare this string I need to substit...
  • djadhav's avatar
    9 years ago

    The first option is try '\d\d:\d\d:\d\d - test123[\s]*\d\d:\d\d:\d\d - test456'. The \s matches the newline character. This works where there is full support for regular expressions. 

     

    If that does not work, try this '\d\d:\d\d:\d\d - test123[\b\n]*\d\d:\d\d:\d\d - test456' (As per this article)

     

    Last option, you can move the checkpoint to use scripting and let VBScript handle the checking.

     

    E.G.

    FUNCTION lib_isRegexMatch(ByVal strPattern, ByVal SearchInThisStr)
    DIM re : SET re = NEW RegExp
    WITH re
    .Pattern = strPattern
    .Global = FALSE
    .IgnoreCase = TRUE
    END WITH
    lib_isRegexMatch = re.Test(SearchInThisStr)
    END FUNCTION

    You can change the global and ignorecase flags as required.