to replace

Hello
I have a table containing phone numbers whose first numbers are either 0 or 98 and I want:
1- Don’t do anything with numbers that start with zero.
2- If the first 2 numbers are 98 or any number, first convert that number to zero.
Please teach me the relevant nodes
For example, I upload an Excel file that is an example of what I want.
ض.xlsx (10.0 KB)

Hi @alex1368 ,

For this replacement you can use the String Replacer node, with regular expressions.

If you are wanting to replace the first 2 digits with “0” whenever the first digit is not zero, you can use the following String Replacer config

The pattern is:
^[^0][0-9](.*)

and the replacement text is:
0$1

The pattern finds any string that:
^ starts with
[^0] a character that is not zero
[0-9] followed by any other digit
(.*) and "captures" everything else. "capture group"

The replacement text means:
0 write a zero
$1 write everything that was "in the first capture group"

If the pattern doesn’t match, it just doesn’t do any replacements.

3 Likes

thank you so much
thank you so much

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