Regular Expression in reading Address

Hi Team,

I have a scenario like. I am reading 5 address lines. In any of the lines i have to find a 5 digit word like DC123 (here DC is static and 123 will be dynamic say i may get DC859, DC254 etc…

In my if condition i have written as ex : item.ToString.Contans(“WC”)
My question is how to append reqular expression after WC which contains 3 dynamic numbers.

  1. Can we put a reqular expression which contains any numerics 1to0 and concatinate with “WC” [or]
  2. Include WC iteslf followed by 1to0 and assign it to a variable and replace it in the above code in “WC”

Can any body provide a need a sample line of code ?

1 Like

Is it always 5 digits? if yes you can find the index of WC or W and take the substring of 5 digits

1 Like


Try below regular expression.

1 Like

So this \d{3} will consider only the immediate next 3 digits after DC as numeric right ?

If yes will check and let you know. Also guys provide any other alternate solutions also if

this does not works.



Yes, Exactly.

1 Like

There are many ways to do it
For example as per your wish with regex
Write this expression directly in a Writeline or assign activity we want
This will concatenate any digit value in item.ToStrjng with “WC” like this “WC123” from the string “DC123”

We can use a simple Replace method like this
In a assign activity
“WC” + item.ToString(“DC”,””).ToString

Kindly try this and let know for any queries or clarification
Cheers @Robotics

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.