akash3 Absent Member.
Absent Member.
6453 views

Various Regular Expressions Available in SilkTest

Jump to solution

[Migrated content. Thread originally posted on 28 September 2011]

Right now, * (wild card) is the only regular expression we are exposed to. Is there any list that contains all regular expression? I searched the help but no luck. Can somebody help me out in this?
0 Likes
1 Solution

Accepted Solutions
lotos Frequent Contributor.
Frequent Contributor.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

And of course:

Imports System.Text.RegularExpressions

should be used

0 Likes
9 Replies
AlexanderF Absent Member.
Absent Member.

RE: Various Regular Expressions Available in SilkTest

Jump to solution
akash originally wrote:
Right now, * (wild card) is the only regular expression we are exposed to. Is there any list that contains all regular expression? I searched the help but no luck. Can somebody help me out in this?


SilkTest does not support regular expressions for locating objects, it does only support the wild cards '?' which matches a single character and '*' which matches any number of characters.
0 Likes
akash3 Absent Member.
Absent Member.

RE: Various Regular Expressions Available in SilkTest

Jump to solution
Any plans to introduce other regular expressions in SilkTest?
0 Likes
VictorO Absent Member.
Absent Member.

RE: Various Regular Expressions Available in SilkTest

Jump to solution
It is possible that this questions has already been raised. The following post might be of help.
0 Likes
AlexanderF Absent Member.
Absent Member.

RE: Various Regular Expressions Available in SilkTest

Jump to solution
akash originally wrote:
Any plans to introduce other regular expressions in SilkTest?


Can you describe the problem you are trying to solve? If we understand that, we can either help you find a solution using existing features or better plan the features we need to add.
0 Likes
Highlighted
lotos Frequent Contributor.
Frequent Contributor.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

Hi guys, regarded to the use of regular expressions, I have next situation:

Imports System.Text.RegularExpressions

Dim actualValue As String = myObject.GetProperty("caption")
If actualValue.Contains("/") = True Then
         actualValue = Regex.Replace(actualValue, "*/""")
Else
End If

OR
         actualValue = actualValue.Replace("*/""")
is the same...


Where for e.g.: actualValue = 2/32546 (this string has the maximum left side's lenght/size = right number's lenght/size, so it might be also = 32546/32546, generally it is: 1->32546/32546)

So, this value can contain 1 to 7 chars as on the left side, same on the right side of the slash. Also both left and right side numbers might be different numbers in different conditions.

What I'm trying here is to replace the slash and whatever it has on the left side with nothing, in this way it should be removed and I'll get just the number from the right side of the slash.

So when I use: actualValue = Regex.Replace(actualValue, "/""") --- this one works well (no regex here: *), the / is replaced with nothing and removed from the entire string, and as a result I get: 232546

But when I'm using: actualValue = Regex.Replace(actualValue, "*/""") --- here, when * is added nothing happens, the string remains the same 2/32546. Tried more combinations of regular expressions and nothing works, any ideas?!

P.S.: When V 14 of Silk Test will be delivered?!

0 Likes
lotos Frequent Contributor.
Frequent Contributor.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

NOTHING?!

0 Likes
Ulrich_Kroemer Absent Member.
Absent Member.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

how about:

var leftPart = actualValue.Split('/')[1]

you know that there's a '/' and you split the string in tow parts and take the one that your're interested in.

as for the release date of Silk Test 14, i am not sure if there is an offical GA date announced yet.

kind regards,

ulrich

0 Likes
lotos Frequent Contributor.
Frequent Contributor.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

solved it, see that:

Dim newActualValue As String

If actualValue.Contains("/") = True Then ''2/32069'

actualValue = Regex.Replace(actualValue, ".*/", "")

actualValue = newActualValue

Else

End If

0 Likes
lotos Frequent Contributor.
Frequent Contributor.

RE: Various Regular Expressions Available in SilkTest

Jump to solution

And of course:

Imports System.Text.RegularExpressions

should be used

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.