Split string and store it in a variable

Hi,
Im trying to split the string and store each value in a variable. like Text "change your …"in one variable hyperlink in one variable and "view details " text in another. here is my string. pls help.

image

Hi @vickyms57,

First Value:
Use Matches activity
Properties
Input : strlContent
Pattern : ((?<=>).*(?=<br))
Result: iEnumResult ->IEnumberable
after that use assign activity to get the data
strFirstValue=iEnumResult (0).ToString()

Second Value:
Use Matches activity
Properties
Input : strContent
Pattern : ((?<=>).*(?=<\/a))
Result: iEnumResult ->IEnumberable
after that use assign activity to get the data
strSecondValue=iEnumResult (0).ToString()

Regards,
Arivu

Thanks @arivu96,

How to extract only “View Details” text and href “URL”.

Refer this @vickyms57

Regards,
Arivu

Can you highlight exactly which bits of info you need to extract? and can you also provide another example of the data set so we can see what patterns, if any, exist?

Hi ,

Im trying to extract hyperlink from below URLs . “(?<=href=”).?(?=“)” and '(?<=href=").?(?=")’ is not supporting in matches activity.

can you send me the url @vickyms57

TEST STRING

Hi @vickyms57,
Try this patten
Pattern : ((?<=href=").*(?=">))

Regards,
arivu

Here is the test strings

`<a href="http://www-wip.dell.com/en-us/shop/accessories/apd/210-alwd" target="_blank">View Details</a>`

<a href="http://accessories.dell.com/sna/productdetail.aspx?c=ca&amp;l=en&amp;s=dhs&amp;cs=cadhs1&amp;sku=451-BBVQ&amp;newtab=true">View Details</a>

Pattern : ((?<=href=“).*(?=”>))

This is also not working . Error Expression Expected.

can you send me what exception are you getting??? for me working fine @vickyms57

Regards,
Arivu

I tried with single quotes also. Its showing the same

Hi @vickyms57,

Try this pattern
((?<=href=.).*(?=.>View))

Regards,
Arivu

Thanks @arivu96,
This doesn’t work for me, because “view” text is not static, text will change dynamically. Is there any way to add pattern with out “”.

Hi @vickyms57,

i thought View Detail is default one you gave the example also in that so i given like that.
Use this pattern
((?<=href=.).*(?=.>.*<))

Regards,
Arivu

Hi,

With the regex you have provided I have 2 scenarios of which

In these I am getting “target=_blank” included in the output in scenario 1. Is there any way to get rid of it?

However when there is no target=blank there is no such issue.

ok try this @vickyms57

Pattern ((?<=href=[""']).+?(?=[""']))

Please try to explain all the scenarios so you can get exact answer. :slight_smile:

Regards,
Arivu

@vickyms57

You should use the pattern in matches activity, but it seems you are using in assign activity

Tha’ts why it is showing compilation error.

Regards,
Mahesh