Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:09:19+00:00 2026-05-23T16:09:19+00:00

String strLine = ; try { BufferedReader b = new BufferedReader(new FileReader(html.txt)); strLine =

  • 0
    String strLine = "";

    try
    {
        BufferedReader b = new BufferedReader(new FileReader("html.txt"));
        strLine = b.readLine();
    } catch(Exception e)
    {
        e.printStackTrace();
    }   

    String[] temp = strLine.split("<");
    temp = temp[1].split(">");
    String temp1 = ("<"+temp[0]+">");

    strLine = strLine.replaceFirst(temp1,"");
    System.out.println(strLine);

Basically I want to remove this string

<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA"> 

from from the file that contains

<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA">no'b?l</span> 

However so far my code works only if the string contains no quotes. How can I fix this problem. I have tried using

.replaceAll("\\\"","\\\\\""); 

but still failed.

Any help or info will be greatly apreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:09:19+00:00Added an answer on May 23, 2026 at 4:09 pm

    Your problem is that replaceFirst accepts a regular expression, but you’re feeding it an arbitrary string, that might contain all sorts of special characters that have a specific meaning in a regular expression. I don’t think the quotes are your problem, but rather the question mark parentheses.

    One way to work around this is to use the String#replace method, which accepts a string rather than a regular expression. That is, use the following line:

    strLine = strLine.replace(temp1,"");
    

    This differs from your code in that it replaces all the instances of temp1 in that line, and not just the first one, but I think you should be fine with that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

try { BufferedReader br = new BufferedReader(new InputStreamReader(item.getInputStream())); String strLine = ; StringTokenizer st
class Patmatch { static String strLine=; public static void main(String [] args) { try
string strLine;//not constant int index = 0; while(index < strLine.length()){//strLine is not modified}; how
string [] files = new string[2]; files[0] = ThinkFarAhead.Example.Settings.Configuration_Local.xml; files[1] = ThinkFarAhead.Example.Settings.Configuration_Global.xml; //Resharper complains
string[] filesOfType1 = GetFileList1(); string[] filesOfType2 = GetFileList2(); var cookieMap = new Dictionary<string, CookieContainer>();
String[] a = c.toArray(new String[0]); First: Do I need type cast here? (I think
I have this string with HTML inside: <span title=whatever>something I want to preserve</span>... I'm
i need to split and string Sentence:NounPhrase| VerbPhrase NounPhrase:Art| Noun Sample:the this should be
String or binary data would be truncated. linq exception, cant find which field has
String s = ; for(i=0;i<....){ s = some Assignment; } or for(i=0;i<..){ String s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.