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

  • Home
  • SEARCH
  • 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 8370563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:56:34+00:00 2026-06-09T13:56:34+00:00

I’m working in a project I was requested to make and it must work

  • 0

I’m working in a project I was requested to make and it must work in other browsers the same way as expected in IE8.

This is a system used to translate HTML into BBCode and vice-versa.

My current problem is to translate HTML into BBCode (BBCode into HTML is solved (I hope)).

I have, as an example, this kind of input to translate (this is a spoiler)

<DL contenteditable=false><DT>Spoiler:</DT><DD class=codebox contenteditable=true>someTextToBeSpoiled</DD></DL>

if it has multiple lines it’s even worse!

<DL contenteditable=false><DT>Spoiler:</DT><DD class=codebox contenteditable=true>Line1</DD><DD class=codebox contenteditable=true>Line2</DD><DD class=codebox contenteditable=true>line3</DD></DL>

What ever code I must use for this translation it must be (kinda) rewritable into a generalist code that works for almost any HTML structure so is supposed to work with this specific code for the spoiler tag the same way it works with any other code. I do know where the data is in each one of them.

To try to solve this for ie8 (for others I use a better solution using methods not available in ie8 and, BTW, they solve it quite fast).

` var theOuterHTML = document.createElement(‘div’);
theOuterHTML.innerHTML = “

Spoiler:

” + “” + “”;

var searchContent = regexEscape(theOuterHTML.innerHTML).replace("<!\\-\\- !!@here1!!# \\-\\->", "(.*?)")

searchContent = searchContent.replace("\n", "");

new RegExp(searchContent, "gm").exec(param1['context'].outerHTML)[1]

`

The problem is that the var searchContent gets the following after all that code (replace is there but seem to do nothing):
<DL contenteditable=false>
<DT>Spoiler:</DT>
<DD class=codebox contenteditable=true>someTextToBeSpoiled</DD></DL>
(yes, with those weird new lines with no reason to exist)
The replace seem to do nothing about those new lines and adding new lines into the input is not possible (due to the unpredictability of ie8).

The end text that should exist is:
[spoiler]someTextToBeSpoiled[/spoiler]

How can such thing be solved? I’ve been puzzling in this all day 🙁

  • 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-06-09T13:56:35+00:00Added an answer on June 9, 2026 at 1:56 pm

    This becomes quite hackish but I believe I found a possible solution.

    The problem with IE8 is that is adds \r\n after some tags for a reason I just don’t understand

    Unlike what it says in the spec, if you use .replace("\n", "") this is not a global replace, ie8 does
    .replace(/\n/, "") instead of .replace(/\n/gm, ""). Also, because it adds a \r\n and not just \n, that replacement is not enough, that’s what has mostly been puzzling me. In order to get a proper replacement you need .replace(/\r\n/mg, "") (no need for the pipe character, it’s not an OR it’s the \r followed by the \n).

    In the end, this may and probably is hackish but that’s the way to deal with IE8 and before, as far as I know….

    By using .replace(/\r\n/mg, "") I was able to get a match in the exec() method.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

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.