Reputation: 636
I try to create regex, which ignores slash-sign by selection. For example i have content like this in my column "things":
arbit
t/obt
t/comp
t/dor
cramp
pod
I only can type: pod, tdor, arbit, tcomp
I have tried with "REGEXP_SUBSTR
"-Expression, but maybe it is not appropriate for this issue.
Upvotes: 0
Views: 96
Reputation: 12438
Imagine that you have the following table:
$ select * from PERSONS;
PersonID LastName FirstName ADDRESS CITY
1 arbit null null null
2 t/obt null null null
3 t/comp null null null
4 t/dor null null null
5 cramp null null null
6 pod null null null
You can use the following simple replace
that does not use regex:
select Replace(Lastname,'/','') from persons;
-- you can omit the replacement part select Replace(Lastname,'/') from persons;
--Replace(Lastname,'/','')--
arbit
tobt
tcomp
tdor
cramp
pod
If you really need to do a complex search and replace that uses regex: (this is not necessary in your case)
$ select REGEXP_REPLACE(Lastname, '/', '') from persons;
--REGEXP_REPLACE(Lastname, '/', '')--
arbit
tobt
tcomp
tdor
cramp
pod
You can also omit the replacement part since it is empty:
select REGEXP_REPLACE(Lastname, '/') from persons
Upvotes: 2
Reputation: 175786
You could use simple replace to remove /
:
SELECT things, REPLACE(things, '/', '')
FROM tab
Upvotes: 2