Get umpteen phrases from a String with regex

Hey everyone,

I want to check if in a text is a address like:

test gmbh
testway 123
1234 US

this address is olways the same so i found out that i can check for the phrases like this:
(test gmbh|testway 123|1234 US)
but I want that if one phrase is different like:

test gmbh
testway 123
1234 USA

I don’t get an outcome. And other question is how I can put special sine like + in the regex phrase?
thanks for your help.

grafik

give try on
grafik
and refer to groups:
grafik

danke

see updated for the adress
war aber nicht sicher ob, klammer und pipe im string wirklich vorkommen oder es symbolisch gemeint war

nop das war der regex denn ich mir so schomn gebaut hatte

when we are bound to line breaks keep in mind the windows typically linebreaks \r\n which do handle defensive:

As a starter (when we do have the adress text block isolated)
grafik

but maybe can also handled with the string split method

I think you understand me wrong I won’t. I have a string and I want to check in the string if this address exists and the address is all the time the same.

Ok, thanks for clearification

maybe a LINQ will also serve:

arrAdressTokens = {"test gmbh","testway 123","1234 US"}

assign activity:
left: check | Boolean
right:
arrAdressTokens.All(Function (x) YourAdressString.Contains(x))

Hi @unandi_ks

If there is no compulsion on using regex,

You can use an InStr(VB) method or Contains method (C#)

Let’s say you have a String variable which contains the input text

String text = “test gmbh
testway 123
1234 US”

You can use the following expression to check if the text that you want to search exists or not

(
Len(text)>0

AND

InStr(text, “test gmbh”)>0

AND

InStr(text, “testway 123”)>0

AND

InStr(text , “1234 US”)>0

)

If the whole expression is true, then you got a match else no match

1 Like

thanks for that

Maybe I do it wrong but it doesn’t work in RegExr: Learn, Build, & Test RegExBildschirmfoto 2021-10-13 um 16.59.28|690x185

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