I am using oracle10g.
I want to remove all occurrences of particular word from sentence, But I don't want to remove any other word which contains other characters between a-z or A-Z.
For example, Following is a sentence from which I want to remove some:
some text, 123 someone, another text some1
Expected output:
text, 123 someone, another text
Note that I also want to remove some word if it contains some+ any other word than A-Z and a-z before or after some.
This is what I have tried so far:
select replace('some text, 123 someone, another text some1','some','')
from dual;
I am getting output:
text, 123 one, another text 1
In above output I am expecting someone not to be replaced and some1 should be replaced totally.
How should I achieve this? Any suggestion will be appreciated.
Edit: For clarity this is another example of what I am looking for:
some other text someone other text, someB some1 some.
output should be:
other text someone other text, someB
From above sentence someB is not removed because it has characters between a-z
And some1 and some. is removed becasue it doesn't has characters between a-z.
Edit2
If I use regex:
select REGEXP_REPLACE('some text, 123 someone, another text some1','[^a-zA-Z]','')
from dual
I am getting output:
sometextsomeoneanothertextsome
Expected output:
sometextsomeoneanothertext
Note that I want some1 also be removed from string as it contains other character than A-Z.
Answers using regex are also appreciated.
somefrom sentence, No need to handle sequence. Everysomewhich doesn't containssome+words betweenA-Zanda-zat the beginning and at the end.