Java replace matches with variables -


/* phone numbers starting 0 after space character , replace 0 "+44 (0)" */      import java.util.regex.*;      public class reg6 {          public static void main (string [] args) {              string variable1 = "test";             pattern phone = pattern.compile("\\s0");             matcher action = phone.matcher(args[0]);             string worldwide = action.replaceall(" +44 (0) ");             system.out.println(worldwide);          }     } 

how can place variable1 replaceall method? if there string {$variable_1} wish replace variable_1 possible?

its in php template

"{$test}" - want use name matches in string , find variable matches string , put there replacing variable value

its in templates

you don't have use pattern or matches try following

    string number ="028346";     if(number.startswith("0"))         system.out.println("+44 (0)" + number.substring(1)); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -