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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:03:33+00:00 2026-06-03T09:03:33+00:00

I ran JSLint on some inherited code, and received the following: Problem at line

  • 0

I ran JSLint on some inherited code, and received the following:

Problem at line 24 character 36: Unexpected '\'.

content = content.replace(/\<a href=/g, '<a target="blank" href=');

I’ve been Googling for a while and found this which suggests that I don’t have to escape less thans in a Javascript replace.

HTML += '<div class="articleBody">' 
    + this.myData.record[0][0][5].replace(/<\/?a[^>]*>/gi,'') + '</div>';

But my standard regExp intro would suggest they do, as do some other random sites, that last even talking specifically about Javascript (though its own examples suggest JSLink is right).

The next assertion characters match at the beginning and end of a
word, they are:

< and >

Though Mozilla’s pages (replace() and RegExp) don’t say it does do assertions with < & >, I’ve been unable to find a place that explicitly says Javascript intentionally doesn’t do assertions with < in its RegExp/replace method. That is, I haven’t found anywhere that says a Javascript implementation that escapes < is wrong. And, indeed, the escaped or unescaped < seems to work fine. Admittedly any escaped char that isn’t reserved seems to work fine — for example, \e === e, though \t !== t wrt replace().

Aside: I do realize that not all RegExp implementations are equal, and realize Javascript doesn’t do, for example, look-behind. But that’s pretty common knowledge. The assertions I’m having a harder time finding.

Can someone put this to bed for me? Is there someplace to find that It Is Written that < is intentionally ignored as a marker of an assertion in Javascript RegExp and that anything to the contrary is incorrect behavior?

  • 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-03T09:03:34+00:00Added an answer on June 3, 2026 at 9:03 am

    JSLint is lint, it tells you your code is problematic (according to the author’s standard), but that does not mean your code is semantically wrong. People escape < and > to avoid the piece of Javascript code being interpreted as HTML, although escaping < in your case is useless.

    It is guaranteed that, in JS Regex, \< is equivalent to <. (ECMA-262 §15.10.2, IdentityEscape). Basically, any non-alphanumerics escaped are equal to itself. (However, \e does not seem to be defined in the standard.) It is unrelated to assertions (?<=…).

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

Sidebar

Related Questions

I ran JSLint on this JavaScript code and it said: Problem at line 32
Recently, I ran some of my JavaScript code through Crockford's JSLint , and it
I ran across the following code in Ely Greenfield's SuperImage from his Book component
Ran accross the following code in an article and didn't think it was standard
I ran into a little problem. I am creating a web app with code
I just ran one script through JSlint and received tons of errors - all
Ran across this line of code: FormsAuth = formsAuth ?? new FormsAuthenticationWrapper(); What do
Ran into a bit of an issue with some jQuery code, but in essence,
Ran into this error message while trying to select some records off a table.
We ran into some strange results recently in one of our Perl scripts, where

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.