How to I replace the word the regardless of case [on hold]











up vote
-4
down vote

favorite












I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}



public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}


}



The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."










share|improve this question









New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Here is the answer you are looking for stackoverflow.com/questions/5054995/…
    – dividedbyzero
    2 days ago















up vote
-4
down vote

favorite












I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}



public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}


}



The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."










share|improve this question









New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1




    Here is the answer you are looking for stackoverflow.com/questions/5054995/…
    – dividedbyzero
    2 days ago













up vote
-4
down vote

favorite









up vote
-4
down vote

favorite











I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}



public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}


}



The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."










share|improve this question









New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}



public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}


}



The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."







java regex






share|improve this question









New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago





















New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









panickingn00b

11




11




New contributor




panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






panickingn00b is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal yesterday


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1




    Here is the answer you are looking for stackoverflow.com/questions/5054995/…
    – dividedbyzero
    2 days ago














  • 1




    Here is the answer you are looking for stackoverflow.com/questions/5054995/…
    – dividedbyzero
    2 days ago








1




1




Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago




Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Morgemoulin

Scott Moir

Souastre