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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:37:46+00:00 2026-06-01T17:37:46+00:00

I am trying to get a regex expression to accept < and > as

  • 0

I am trying to get a regex expression to accept < and > as my outside delimiters to grab all the content in between them.

so content like such

< tfdsfa  >

should be grabbed.

Do I have to escape the < and > characters or something?

Regex generated by my script:

/<[^(>)]*>/g

Code from file:

data.method.highlight = function() {
    var x = data.syntax,
        text = data.$.span.html();
    for (var i=0, len = x.length; i < len; i++) {
        var rx;
        if (x[i].range) {
            rx = new RegExp(x[i].tag[0] + "[^(" + x[i].tag[1] + ")]*" + x[i].tag[1], "g");
            console.log(rx);
        }
        else {
            var temprx = x[i].tag[0];
            for (var z = 1; z < x[i].tag.length; z++) {
                temprx += "|" + x[i].tag[z];
            }
            rx = new RegExp(temprx, "g");
        }
        text = text.replace(rx,function (match) {
            console.log("looping - range");
            return '<span class="' + x[i].class.default + '">' + match + '</span>';
        });
        data.$.span.html(text);
    }
};
  • 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-01T17:37:48+00:00Added an answer on June 1, 2026 at 5:37 pm

    Neither < nor > are metacharacters inside a regular expression.

    This works for me:

    '<foo> and <bar>'.match(/<[^>]*>/g); // ["<foo>", "<bar>"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get all words inside a string using Boost::regex in C++. Here's
I am trying to write a regex to get the numbers from strings like
I am trying to formulate a regex expression in JavaScript to get the cents
I am trying to get a regex expression to match a specific url format.
I'm trying to figure out how to get my regular expression to accept certain
I'm trying to get the following regular expression to grab only the letters from
I'm trying to get a regex that will match: somefile_1.txt somefile_2.txt somefile_{anything}.txt but not
I'm stuck trying to get a regex to match a filetype in a sorting
I'm trying to get the following regex to work on my String: Pattern Regex
I am a bit puzzled with my Regex results (and still trying to get

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.