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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:42:20+00:00 2026-05-27T03:42:20+00:00

I have created a javascript sort function to sort a list of articles by

  • 0

I have created a javascript sort function to sort a list of articles by title. I am going to convert all of the sortable words to capital letters so I do not have to deal with the differences associated with lower case and upper case. I am having trouble creating an expression though that wipes out all characters before the word that are not [A-Z]. I am not very familiar with regular expressions and any help would be appreciated. I am looking for something like this…

function cleanup(e) {
// delete leading not alphanum characters
// capitalize for sorting
//  str.replace(/^\s*/, '').replace(/\s*$/, ''); 
return(e);
}
  • 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-05-27T03:42:21+00:00Added an answer on May 27, 2026 at 3:42 am

    If you use the i delimiter, the regular expression will be case insensitive, you might use this when you compare words.

    Try this http://jsfiddle.net/5Rxs5/

    Will replace all non a-zA-Z characters before the text:

    var str = "#$DSFfd#_)#$$";
    
    alert(str.replace(/[^a-z]+/i, ""))
    

    If you want to remove all non a-zA-Z character do this (added the g delimiter, which means global):

    var str = "#$DSFfd#_)#$$";
    
    alert(str.replace(/[^a-z]+/gi, ""))
    

    Uppercase first char

    var str = "#$abcd#_)#$$";
    str = str.replace(/[^a-z]+/i,"");
    str = str.match(/(^.)(.+)/);
    str = str[1].toUpperCase() + str[2];
    
    alert(str);
    

    Alerts:

    Abcd#_)#$$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created two JavaScript files. One file is "validators.js" and the other is
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I have an array I've created in JavaScript. The end result comes out to
I have a few divs created dynamically in Javascript.I was wondering if it is
Can JavaScript classes/objects have constructors? How are they created?
A lot of JavaScript libraries have user interface widgets. Usually they are created after
I have a site which relies heavily on javaScript. I created a mirror site,
I have a dialog box, created with the code javascript and HTML generated below.
Ok, I have one JavaScript that creates rows in a table like this: function
Let's say you have a JavaScript class like this var DepartmentFactory = function(data) {

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.