Split string and store it in a variable


#1

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


#2

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


#3

Thanks @arivu96,

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


#4

Refer this @vickyms57

Regards,
Arivu


#5

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?


#6

Hi ,

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


#7

can you send me the url @vickyms57

TEST STRING


#8

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

Regards,
arivu


#9

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>


#10

Pattern : ((?<=href=").*(?=">))

This is also not working . Error Expression Expected.


#11

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

Regards,
Arivu


#12

I tried with single quotes also. Its showing the same


#13

Hi @vickyms57,

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

Regards,
Arivu


#14

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 “”.


#15

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


#16

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.


#17

ok try this @vickyms57

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

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

Regards,
Arivu


#18

@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