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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:39:41+00:00 2026-06-10T11:39:41+00:00

Ok, I have a large multidimensional JSON object being poured into my app, of

  • 0

Ok, I have a large multidimensional JSON object being poured into my app, of which one of the objects is an html string, for creating links. Now I have no ability to change the output of this Object currently to replace what I want to with what I need to because this object is used in a couple places through out a few different applications. Of which works fine up til now.

What I need to do is replace a small piece of this html string in the JSON object to alter it so it fits the needs of this new application.

The HTML within the object looks like (taken directly from firebug console under “response tab” less the whole object data)

<a href='\/ng\/other\/?object_id=6bfb00fb-2b76'>Some Text<\/a>

What I need to do is replace the “ng” and “other” within that string to something else entirely. To which I have tried.

var swapVal1 = data.rows[index1].vals[1].replace(\/ng\/other\/,"/new/placement/");

However I get SyntaxError: illegal character Line 31 and its pointing to the first piece of the replace function. So, what is it I would need to do, in order to handle this properly for the time being until other things can be rewritten on the back end as a better alternative to this problem.

  • 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-10T11:39:42+00:00Added an answer on June 10, 2026 at 11:39 am

    Your regex is malformed. Try this:

    var swapVal1 = data.rows[index1].vals[1].replace(/\\\/ng\\\/other\\\//, "/new/placement/");
    

    Regex literals are bounded by the / character. The backslash character, \, is used to escape regex metacharacters, and so needs to be escaped to \\. Since the / character is used to denote the start and end of a regex literal, it also needs to be escaped to \/. So you can break the regex down to this:

    /     -> start of regex
    \\    -> the first \
    \/    -> the next /
    ng    -> the string "ng"
    \\    -> the next \
    \/    -> the / after that
    other -> the string "other"
    \\    -> the next \
    \/    -> the / after that
    /     -> end of the regex
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have large C# application spanning many projects which is packaged into an .MSI
I have a large multidimensional array that I would like to store into a
I have a large multidimensional array and I basically want to drop the first
I have many large multidimensional NP arrays (2D and 3D) used in an algorithm.
I have a very large multidimensional array and I would like to sort it
I have a large array in PHP. It contains strings that are split into
I am developing an application which doesn't have large requirements for data storage. I
I have a postgresql database which contains multidimensional data. What I did was I
I have a string I would like to separate and make a multidimensional array
I have a large multidimensional array structured like the sample below. [ ['name' =>

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.