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 6064161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:15:00+00:00 2026-05-23T09:15:00+00:00

I have a multiline HTML document that I am trying to get some stuff

  • 0

I have a multiline HTML document that I am trying to get some stuff from. I’m using java’s regex (I know – XML parsers bla bla bla, just bear with me here please 🙂 ).

    dfahfadhadaaaa<object classid="java:com.sun.java.help.impl.JHSecondaryViewer" width="14" height="14">
<param name="content" value="../Glossary/glInterlinkedTask.html">

<param name="text" value="interlinked task">
<param name="viewerActivator" value="javax.help.LinkLabel">
<param name="viewerStyle" value="javax.help.Popup">
<param name="viewerSize" value="390,340">
<param name="textFontFamily" value="SansSerif">
<param name="textFontWeight" value="plain">
<param name="textFontStyle" value="italic">
<param name="textFontSize" value="12pt">
<param name="textColor" value="blue">

<param name=iconByID" value="">
</object>
sjtsjsrjrsjsrjsrj

I’ve got this HTML in a string: input.

    input = input.replaceAll("<object classid=\"java:com.sun.java.help.impl.JHSecondaryViewer.*?object>", "buh bye!");

Obviously, it’s not working. HOWEVER, I can get a pattern match if I use pattern.compile with Pattern.DOTALL.

So, my question is – how can I do something like Pattern.DOTALL with string.replaceall?

  • 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-23T09:15:01+00:00Added an answer on May 23, 2026 at 9:15 am

    Attach (?s) to the front of your pattern :

    input = input.replaceAll("(?s)<object classid=\"java:com\\.sun\\.java\\.help\\.impl\\.JHSecondaryViewer.*?object>", "buh bye!");
    

    From the Javadoc:

    Dotall mode can also be enabled via the embedded flag expression (?s). (The s is a mnemonic for "single-line" mode, which is what this is called in Perl.)

    Other flags work this way as well

    Special constructs (non-capturing)

    …

    (?idmsux-idmsux) Nothing, but turns match flags i d m s u x on – off

    On a side note, if your goal is to remove unsafe objects from HTML from an untrusted source, please don’t use regular expressions, and please don’t blacklist tags.

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

Sidebar

Related Questions

I have some text content (read in from the HTML using jQuery) that looks
I'm trying to get some input from a user and use that input in
i have this pattern i using to replace string: var html = some test
I have a chat window (using a <div> ) that sometimes needs to get
I have a MultiLine asp:Textbox (a standard html textarea for those non-asp people) that
I have a multiline input on my html form and some browsers (firefox 4
I have a complex Regex which is used to help strip out HTML from
I have a simple html multiline tooltip implementation: this.tooltip = function(tag) { xOffset =
Is it possible (by using the stock c# TreeView) to have Multiline TreeNodes? Also,
I have a multiline text string (e.g. Stuff\nMore Stuff\nYet More Stuff), and I want

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.