I have data in a column as :
dfh 2 dsf
lkhtrh 1 bv 1
bdchfd 15 sdf, 9
as per my requirement, first 3 values are fine. I have modify the others as below(ending digits with or without space , and _ have to be removed):
lkhtrh 1 bv
bdchfd 15 sdf
can anyone lease help me to write any such regular expression to fit the requirement.
This removes all trailing digits, spaces, underscores and commas, regardless of order:
RegExp_Replace(col, '[0-9,_ ]*$', '') -- 'vcsvcvc 3,_34' -> 'vcsvcvc'
And this trailing digits and any optional spaces, underscores and commas before:
RegExp_Replace(col, '[,_ ]*[0-9]*$', '') -- vcsvcvc '3,_34' -> 'vcsvcvc 3'