sql - Remove special character from end of string -
i looking remove special characters end of string.
input:
looking oracle ~( looking ~! oracle ~( stack looking ~! oracle ~( stack ##
output:
looking oracle looking ~! oracle ~( stack looking ~! oracle ~( stack
so need remove non-alphanumeric characters end of string only.
i looking oracle sql query achieve this.
select regexp_replace(str, '[^[:alnum:]]*$') from....
where str
input string value. remove non-alphanumeric characters @ end of str
($
anchoring @ end; *
means many possible consecutive characters; [...]
means character matching set, , ^
within character matching set means negation). not giving third argument regexp_replace()
, substring replaced nothing (''
)
Comments
Post a Comment