replace number to words in right position in java
<p>Actually I'm trying to replace number to words in the sentence that giving by user. This case date format; For example: <code>My birthday is on 16/6/2000 and I'm newbie to the java</code> --> <strong><em>become</em></strong> ---> <code>My birthday is on sixteenth july two thousand and I'm newbie to the java</code> </p>

<p>Here is code:</p>

<pre><code>        Scanner reader = new Scanner(System.in);
        System.out.println("Enter any numbers: ");
        String nom = reader.nextLine(); // get input from user

        //checking contains that has "/" or not
        if(nom.contains("/")){
           String parts[] = nom.split("[/]"); 
           String part1 = parts[0]; //data before "/" will be stored in the first array
           String day[] = part1.split("\\s+");// split between space
           String get_day = day[day.length -1];// get last array

           String get_month = parts[1]; //data in the between of "/" will be stored in the second array

           String part3 = parts[2]; // data after "/" will be stored in the third array
           String year[] = part3.split("\\s+");// split between space
           String get_year = year[0];// get first array

           String s = NumberConvert.convert(Integer.parseInt(get_day)) + 
                      NumberConvert.convert(Integer.parseInt(get_month)) + 
                      NumberConvert.convert(Integer.parseInt(get_year));

           String con = nom.replaceAll("[0-9].*/[0-9].*/[0-].*", s); // replace number to word        
           System.out.println(con); // print the data already converted
        } else {....}
</code></pre>

<p>But the result that I have got is:</p>

<pre><code>My birthday is on sixteenth july two thousand 

//"and I'm newbie to the java" is disappear [How to solve it]//
</code></pre>

<p>How to solve it. Actually I want to get value before and after of "/" slash and convert it to words and replace it as a original input from user.</p>

<p>What I have tried is:</p>

<pre><code>String con = nom.replaceAll("[0-9].*/[0-9].*/[0-9999]", s); // a bit change [0-9].* to [0-9999] 
</code></pre>

<p>But output become like this:</p>

<pre><code>My birthday is on sixteenth july two thousand 000 and I'm newbie to the java
//after two thousand index "000" is appearing
</code></pre>