Hi @Diego_Marquez !
You can try using scripting languages like Python or Powershell as it a lot faster.
Here is one flow:

You can choose either Powershell or Python as both give the same result.
Powershell code:
# Original string
$originalString = "%String%"
# Split the string by the dot
$splitArray = $originalString -split "\."
# Remove the last empty element if it exists
if ($splitArray[-1] -eq "") {
$splitArray = $splitArray[0..($splitArray.Length - 2)]
}
# Remove the last value
$splitArray = $splitArray[0..($splitArray.Length - 2)]
# Get the second last value and append the new value
$newValue = "NEWVALUE"
$splitArray[-1] = $splitArray[-1] + $newValue
# Join the array back into a string
$newString = $splitArray -join "."
# Output the new string
$newString
Python code:
# Original string
original_string = "%String%"
# Split the string by the dot
split_list = original_string.split(".")
# Remove the last empty element if it exists
if split_list[-1] == "":
split_list = split_list[:-1]
# Remove the last value
split_list = split_list[:-1]
# Get the second last value and append the new value
new_value = "NEWVALUE"
split_list[-1] = split_list[-1] + new_value
# Join the list back into a string
new_string = ".".join(split_list)
# Output the new string
print(new_string)
Full code of the flow (just copy and paste into your flow):
SET String TO $'''36.43.40.42.38.419.37.45.'''
@@copilotGeneratedAction: 'False'
Scripting.RunPowershellScript.RunPowershellScript Script: $'''# Original string
$originalString = \"%String%\"
# Split the string by the dot
$splitArray = $originalString -split \"\\.\"
# Remove the last empty element if it exists
if ($splitArray[-1] -eq \"\") {
$splitArray = $splitArray[0..($splitArray.Length - 2)]
}
# Remove the last value
$splitArray = $splitArray[0..($splitArray.Length - 2)]
# Get the second last value and append the new value
$newValue = \"NEWVALUE\"
$splitArray[-1] = $splitArray[-1] + $newValue
# Join the array back into a string
$newString = $splitArray -join \".\"
# Output the new string
$newString''' ScriptOutput=> PowershellOutput ScriptError=> ScriptError
@@copilotGeneratedAction: 'False'
Scripting.RunPythonScript PythonCode: $'''# Original string
original_string = \"%String%\"
# Split the string by the dot
split_list = original_string.split(\".\")
# Remove the last empty element if it exists
if split_list[-1] == \"\":
split_list = split_list[:-1]
# Remove the last value
split_list = split_list[:-1]
# Get the second last value and append the new value
new_value = \"NEWVALUE\"
split_list[-1] = split_list[-1] + new_value
# Join the list back into a string
new_string = \".\".join(split_list)
# Output the new string
print(new_string)''' PythonVersion: System.PythonVersion.Python3 ScriptOutput=> PythonScriptOutput ScriptError=> ScriptError
Output:
Before:

After:


So it will replace ".45." which comes in format as you said some data between the dots and at the end always with any value you specify in the script. I replaced that with "NEWVALUE"
Other input:
Before:

After:

I hope this helps.