fork(15) download
  1. class Ideone {
  2. static void main(String[] args) {
  3. String s = "hey where.is.the book on.brown.table\nhey there.is.a.boy.in.the city Delhi\nhey here.is.the.boy living next door"
  4. print s.replaceAll(/(\G(?!\A)\w+|\b(?:where|there)\b)\./, '$1_')
  5. }
  6. }
  7.  
Success #stdin #stdout 0.92s 78896KB
stdin
Standard input is empty
stdout
hey where_is_the book on.brown.table
hey there_is_a_boy_in_the city Delhi
hey here.is.the.boy living next door