All Forums Aster
nurandi 1 post Joined 02/14
27 Feb 2014
Replace all characters in string except particular words

Dear All,
I am trying to replace all characters in string except particular words using regexp_replace() function in Aster.
For example, replace all chars in string "I will go to Jakarta, Bandung and Bali next month" with "X", except "Jakarta", "Bandung" and "Bali". So, expected result will be "X JakartaX Bandung X Bali X".
I know how to replace all chars except particular chars using regex_replace. Ex: regexp_replace('baca buku','[^abc]','X','g') will return "bacaXbXXX".
Any suggestions are really appreciated ..

j355ga 100 posts Joined 12/05
17 Mar 2014

I have not used database regex_replace, but using any regex function I think you could embded a series to incrementtally replace.  
1. Replace Jakarta with a single char - say "+"
2. Replace all alpha with X
3. Replace "+" with Jakarta
Perhaps something like this?
regexp_replace(regexp_replace( regexp_replace(string_col, 'Jakarta', '+'), '[A-Z]{0,}' 'X'), '+', 'Jakarta')


rupa d s 1 post Joined 04/14
12 Apr 2014

I am getting errors while loading data from text file using ncluster_loader .The text file have null values in it.
I tried the option,but its not working.
 ncluster_loader --hostname --username beehive --password beehive --dbname beehive --delimiter ',' --verbose tab1 ipfile.txt
Kindly let me know the solution to load text files with null values to table

16 Apr 2014

If you have a null character representer , try using option "-n".   
ncluster_loader --hostname --username beehive --password beehive --dbname beehive -n "null character representer" --delimiter ',' --verbose tab1 ipfile.txt

Ravi Singh

You must sign in to leave a comment.