Add a space before the first digit in a string

Hey everyone,

Does anybody know how to insert a space before the first number in a string?

for example:

Obere Kanalstr1
Dompfaffenweg18 a
Am Kavierlein29Fürth90765DE
Hindenburgring 11
Friedhofstr.21

Thanks in advance for your help!

Best regards,

Tim

@Tim_Gentemann
Give a try on regex replace with following pattern and replacement:

grafik

Replace:
grafik
$2 (Space$2Space)

we do see that the space before / after is conditional. Also after the digit we would need a space (90765DE). On the Hausnummer it does fail if no space is needed. But depends on your requirements

Thanks a lot for your prompt answer!

In this case I just need to get the space before the first digit because everything after the house number (and the letter addition) will be deleted as it is saved to other variables.

I tried that regex with the regex.replace wizard but unfortunately I dont have the “SUBSTITUTION” section but the “Replacement” section.

When I type “$2” in Replacement, nothing happens. When I type " " the number gets deleted.

@Tim_Gentemann
replacements can be configured here:
grafik

or use Regex.Replace(yourString, YourPattern, YourReplacement)
ensure following:
grafik

I tried both but unfortunately none of them solves the problem.

I have attachced the approach.
Would be very grateful, if you could do the same with your solution, so that I get what I do wrong.
SplitNumberfromStreet.xaml (9.2 KB)

@Tim_Gentemann
XAML was not opening in UiPath. But have a look here produced within UiPath Studio Debug and Watch panel:

kindly note the spaces surrounding the replacement

Also have a look here:

1 Like