# How to use "is match" in this case?

Hello,

I have a list of strings and i want to use the activity “is match” to check (true/false) if the next rule is contained in such strings:

house - NUMBERs

So the following examples would be true:

fdsfsd house - 2 fdfsfsdf
fdsfsd house-1 fdsfsd fdsfsd
fdsfsd house - 4 fdsfsd
fdsfsd house - 3232 fdsfdsdssd fdsfsd fdsfsd

The following examples would be false:

fdsfsd hous-1 fdsfsdsfsd
fdsfsd house -\$1 fdsfsd
fdsfsd house_2

Thank you.

Will some matches have no spaces between house, the dashes, and the number? Or will they all match the pattern from the 1st, 2nd, and 4th line?

The idea is that every string contains the structure “house-number” without considering the spaces between them. So a correct solution would be “house - number” or “house- number” as well.

“House” and “-” can be separated by whatever number of blank spaces, as well as “-” and “number”.

edit: i need sth similar to HOUSE /n+ - /n+ number

where number is a integer number between 1 and infinite

"house[\s-]*\d+"

use this as pattern and check

1 Like

Hello,

It does work, thank you very much.

How could I remove such a structure contained in the string if it exists?

For instance, if the string is " fdsfsd house - 3232 fdsfdsdssd fdsfsd fdsfsd " then I would like to remove house - 3232 so that the final string will be:

fdsfsd fdsfdsdssd fdsfsd fdsfsd

Regards

let’s consider StrVariable = " fdsfsd house - 3232 fdsfdsdssd fdsfsd fdsfsd "
the
NewStrVariable = StrVariable.Replace(“house - 3232”,"")

Try this

(?=house).+

Thanks
Ashwin.S

Hello,

Yes, it works in that particular case, but every case will be different. “house” followed by a “-” and a number will be common in all cases, but such a number will be different.

Hi,

Thank you. How can I implement it?

“house” and “-” is fixed?

Use this pattern within ismatch activity and check

Thanks
Ashwin S

Hello,

Yes, the word house and “-” symbol appears all the time.

The structure is: house-number where number is a integer number.

The thing is that house, “-” and the number can be separated by blank spaces. For instance:

1. house - 1
2. house-43453
3. house- 3

Edit: i just want to delete it when it is contained in a string.

For instance: “kfjdskfdjsk house- 4” should be converted into “kfjdskfdjsk”

Thanks. I already implemented “house[\s-]*\d+” and it worked. The thing now is that i just need to remove such a structure contained in a string.

For instance: “kfjdskfdjsk house- 4” should be converted into “kfjdskfdjsk”

fdsfsd house - 2 fdfsfsdf
fdsfsd house-1 fdsfsd fdsfsd
fdsfsd house - 4 fdsfsd
fdsfsd house - 3232 fdsfdsdssd fdsfsd fdsfs

use this “house[\s-]*\d+” in matches to extract and then get output like outRegex
and use for each loop and get pass this variable to it and use assign activity like this
NewStrVariable =“fdsfsd house - 3232 fdsfdsdssd fdsfsd fdsfs” .Replace(item.ToString,"")
cheers @EngAnalyst

here is a sample workflow
i tried let me know if this what you are lookin for
cheers @EngAnalystRegex.xaml (6.3 KB)

1 Like

Thank you very much. This is the solution.

What if the occurence is higher than 1?

For instance: “kfjdskf house-1 kjdsifjsiodfi house -2”

Would there be any possibility to remove all the patterns so that the text will be "kfjdskf kjdsifjsiodfi "?

good,close this thread by marking it as a solution!
well you can do! without loop thats!

Regex.xaml (5.1 KB)
cheers @EngAnalyst
try this!

1 Like

Thank you very very much for your help.

I wish you have a nice day.

Kind regards!

1 Like

you too cheers
@EngAnalyst