| || |
- 1 Post By NoUse4aName
- 2 Post By venu.adhikesevan
- 1 Post By venu.adhikesevan
regular expression got me stumped
using DP I have a weblist with a name I would like to use a regular expression with
the name varies in value in the middle but is constant with the starting and ending parts of the name
e.g ctl00$m$g_8012d450_2ac0_460b_ad9e_12cb32ff731c$ctl 00$lstPages
so i would like to use a regular expression to declare the object
Set obj_WebList = Description.Create
obj_WebList ("micclass").value = "WebList"
obj_WebList ("name").value = "ctl00$m$g(*)ctl00$lstPages"
but I cant work it out
obj_WebList("name").value = "ctl00\$m\$g.*ctl00\$lstPages"
Think this is it. Need to escape the $ characters with a slash, and .* means anything.
'$' is one of the regex pattern character hence regex parser by default it will consider '$' as regexp character. Since it it used in your pattern (ctl00$m$g(*)ctl00$lstPages) parser will look for the particular pattern, so we need to escape the '$' sign using '\' so that parser will leave the regexp character which is prefixed with escape character.
'$' - Matches the end of input.
If there is any special characters like $,(,*,^ etc... used in patterns then you need to use "\".
even more stumped
so for this time - and I am even more stumped..
I'm trying to get all elements that are: having these properties and putting them into a collection. All I want is to get the webelements in a collection that have "Publish to Collaboration Site (with approval)" as text in a span so I thought I'd try regular expression - Im confused why its not working
[ WebElement ] object
Try this ".*Publish to Collaboration Site \(with approval\).*"
Thats found it !!! great
just one more question - cannot use alt with this object and want to use thr src - but is it already in the regular expression format?
because the inner and outer html is really complicated to use
"innerhtml:=<IMG style=""VISIBILITY: hidden"" alt=""Open Menu"" src=""/_layouts/images/ecbarw\.png"" width=7 height=4>",
All three of your questions really have the same answer. To match a regular expression on a string that has special characters you need to use a \ before each of those special characters to treat them literally and ignore the regex meaning.
At the end there would have to double existing backslash, then add another for the period.
Regular Expression Tutorial - Learn How to Use Regular Expressions