I’m not too sure I follow, but you can strip using the replace method and regular expressions
var str="MaEfSdsfSsdfsAdfssdGsdfEsdf";
var newmsg = str.replace(/[a-z]/g, '');
var old = str.replace(/[A-Z]/g, '');
In this case, newmsg = ‘MESSAGE’.
More Related Contents:
- Regular expression to get a string between two strings in Javascript
- Are JavaScript strings immutable? Do I need a “string builder” in JavaScript?
- How can I extract a number from a string in JavaScript?
- Regular Expression to get a string between parentheses in Javascript
- Insert a string at a specific index
- Is there a way to create a function from a string with javascript?
- Capitalize words in string [duplicate]
- Replace multiple whitespaces with single whitespace in JavaScript string
- Why does “true” == true show false in JavaScript?
- Is there a JavaScript function that can pad a string to get to a determined length?
- How do I check if string contains substring? [duplicate]
- Replacing spaces with underscores in JavaScript?
- Remove whitespace and line breaks between HTML elements using jQuery
- javascript: do primitive strings have methods?
- Is there a downside to using ES6 template literals syntax without a templated expression?
- Pass a string by reference in Javascript
- How to convert a String containing Scientific Notation to correct Javascript number format
- How to convert array into string without comma and separated by space in javascript without concatenation?
- In javascript, is an empty string always false as a boolean?
- Append to string variable [closed]
- javascript for loop counter coming out as string [duplicate]
- Split string on the first white space occurrence
- Insert space before capital letters
- Replace multiple characters by one character with regex
- JavaScript adding a string to a number
- Extract the text out of HTML string using JavaScript
- What is the difference between ‘ and ” in JavaScript?
- Split a string straight into variables
- How to add spaces between every character in a string?
- javascript – Convert array to string while preserving brackets