A Pen by Derek Dhammaloka on CodePen.
Created
February 20, 2024 09:29
-
-
Save derektypist/70526fb0f1f82a566171b00b876e28cb to your computer and use it in GitHub Desktop.
Remove Non Alphanumeric Characters and Change Case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<header class="container-fluid text-center"> | |
<h1>Remove Non Alphanumeric Characters and Change Case</h1> | |
</header> | |
<div id="results"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#results').html(``); | |
function removeNonAlphanumericAndChangeCase(str) { | |
return str.replace(/[^a-zA-Z0-9]/g,'').toLowerCase(); | |
} | |
$('#results').append(`Personal Computers becomes ${removeNonAlphanumericAndChangeCase('Personal Computers')} <br>`); | |
$('#results').append(`Advertise+2 becomes ${removeNonAlphanumericAndChangeCase('Advertise+2')} <br>`); | |
$('#results').append(`This is a test+2+3 becomes ${removeNonAlphanumericAndChangeCase('This is a test+2+3')} <br>`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/js/bootstrap.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); | |
body { | |
font-family: "Roboto", Arial, Verdana, sans-serif; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment