Micro Focus QTP (UFT) Forums

Full Version: Turn Off RegEx
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am having problems finding links that look like so "WildNight(69)" as the value is pulled daily from a table. Setting the value to "Wild Night \(69\)" will not work as every run of 200 links might need many link updates.

So, is it possible to turn RegEx Off?

I found:
ObjLink.RegularExpression = False
but do not know how to use it.

Code:
Set linkDesc=Description.Create
liknDesc("innertext").value=WildNight\([0-9]*\)
Thx Rajpes for that idea too. I will put that ion my bag of tricks to use in the future.

My issue is that I have all types of funny/different characters in my links. So, I found Replace.

Code:
Public Function NormalizeString (OrgStr)

            Dim TempStr
            
            TempStr = Replace(OrgStr, "\", "\\")

            TempStr = Replace(OrgStr, "/", "\/")
            
            TempStr = Replace(TempStr, "*", "\*")
            
            TempStr = Replace(TempStr, "+", "\+")

            TempStr = Replace(TempStr, "(", "\(")

            TempStr = Replace(TempStr, ")", "\)")

             TempStr = Replace(TempStr, "=", "\=")

             TempStr = Replace(TempStr, "&", "\&")

             TempStr = Replace(TempStr, "@", "\@")

             TempStr = Replace(TempStr, "#", "\#")

             TempStr = Replace(TempStr, "_", "\_")

             TempStr = Replace(TempStr, "!", "\!")
            
            NormalizeString = Replace(TempStr, "?", "\?")
            
End Function
I don't think \ is needed for all special characters, it is just to nullify the reg ex wildcard characters
Ranjes

Ok, thx for the info. But for now I will keep as i will see when I run more links that have these characters in the link name.

thx ;-)

Lor