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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:21:30+00:00 2026-06-09T09:21:30+00:00

I am trying to clean an URL (rss feed) such that after the last

  • 0

I am trying to clean an URL (rss feed) such that after the last .rss (or.html) there are no further characters. I’m using the TryIt Editor on w3schools.com for testing. The following is my test code:

var str="http://rss.cnn.com/rss/cnn_world.rsstest";
var patt1=/(.*[.rss|.html]).*/g;
var result = str.replace(patt1, "$1");
document.write(result);

The problem I am having is that the result shown is

http://rss.cnn.com/rss/cnn_world.rsstest

i.e. the “test” didn’t get removed. I am wondering if someone could check my regex and explain what I am doing wrong?

Thank you.

  • 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-09T09:21:32+00:00Added an answer on June 9, 2026 at 9:21 am

    Firstly, I recommend jsFiddle or some other testing service. Forgive my bias.

    Some other answerers seem to have completely missed the point, so to explain your errors:

    1. [] does not group—it defines a character class. What you’ve written actually matches a single character, namely any of these: .|hlmrst.
    2. Without the $ anchor the two .*s may not match what you’d expect.

    Try instead:

    /(\.rss|\.html).*$/g
    

    Here’s the jsFiddle demo.

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

Sidebar

Related Questions

I am currently trying to clean URL in my local machine(wamp) before using that(.htaccess)
I am trying to make clean url with htaccess I have a profile.php page
I'm trying to make a clean url for a blog on a dynamic website,
I am trying to get a regular query appended to any clean URL to
I'm trying to clean up the architecture of my jQuery Mobile application by using
I'm trying to clean-up after an exception, and I'm not sure how to handle
I'm trying to clean up form input using the following Perl transliteration: sub ValidateInput
I'm trying to do the basic mod_rewrite clean URL trick, where /category/item rewrites to
I'm trying to clean up my URLs using mod_rewrite in my .htaccess files. Let's
i am currently trying to learn about clean urls. i was using windows once.

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.