I want to change the data in a cell, I want to change the two most front numbers to 0, for example the data is 628012356, I want to change 62 to 0 so it becomes 080123456, this should use string manipulation,
Example data
62 856939 > 0 856939
62 892395 > 0 892395
62 820502 > 0 820502
please help
hi @septia1509
i’m not an expert in regex, but can try this in string manipulation node,
regexReplace($column1$,“^[62].” , “0” )
rgds
2 Likes
thank you for your help, it’s work
1 Like
takbb
October 27, 2023, 10:57am
5
hi @marzukim and @septia1509 ,
Unfortunately there would need to be a small modification to that regex.
Square brackets indicate the character classes that are to be considered a match, and do not indicate a sequence or the number of characters.
the [62]
represents any single digit which is either a 6
or a 2
.
The "."
then matches any single character
As a result it will actually match the first 2 characters of any string starting with either a 6
or a 2
The following regex would match and replace the first 2 characters, provided they are “62”
regexReplace($column1$,"^62" , "0" )
2 Likes
thanks master takbb, for your regex explanation and suggestion. looks like I need a few more years to master it.
regex is like a wild beast to me … it takes time to tame!
1 Like
takbb
October 27, 2023, 11:29am
7
lol, @marzukim
Keep going, and you’ll tame the beast! (or at least it won’t bite quite so often!)
You probably know about these already, but for anybody else reading who doesn’t, the following sites are great for finding out more
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.
system
Closed
November 3, 2023, 11:29am
8
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.