This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Let's say you have data like this and you'd like to remove the numbers at the end:
You could use Left(x, len), like this:left([Data], (length([Data]) - 4))
(This calculates the length of the field, subtracts 4 and then takes that many characters from the left. E.g.: length(Blue4509) = 8, 8-4 = 4, left(Blue4509,4) = Blue)
Or a combination of ReverseString(Str) and Substring(x, start, length): ReverseString(substring(ReverseString([Data]),4,100))
(This reverses the string, uses a substring to start at the 5th position [positions are zero based], takes the next 100 characters, and then reverses it back. E.g.: reversestring(Blue4509) = 9054eulB, 5th position = e, next 100 characters = eulB, reversing it back results in Blue)
and you want to preserve the number at the beginning of the string but remove the ones at the end?
The $ character in regex denotes the end of the string, * identifies one or more instances of the preceding character, so \d*$ identifies one or more digits at the end of the string: regex_replace([Data], "\d*$","") or: