RegExp match test
How do I make an regexp match test?
What is a regexp match test? How do you make a regexp match test? This script and codes were developed by Honglio on 11 August 2022, Thursday.
RegExp match test - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>RegExp match test</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <title>RegExp - search for strings</title>
<form id="textsearch">
<textarea id="incoming" cols="150" rows="8">
/** * @license Handlebars hbs 0.8.1 - Alex Sexton, but Handlebars has its own licensing junk * * Available via the MIT or new BSD license. * see: http://github.com/jrburke/require-cs for details on the plugin this was based off of */
</textarea>
<p> Search pattern: <input id="pattern" type="text" value="bu(t|r)"/>
</p>
</form>
<p id="searchSubmit">Search for pattern</p>
<div id="searchResult"></div> <script src="js/index.js"></script>
</body>
</html>
RegExp match test - Script Codes CSS Codes
#searchSubmit { background-color: #ff0; width: 200px; text-align: center; padding: 10px; border: 2px inset #ccc;
}
.found { background-color: #ff0;
}
RegExp match test - Script Codes JS Codes
window.onload = function () { document.getElementById("searchSubmit").onclick = doSearch;
};
function doSearch () { var pattern = document.getElementById("pattern").value; var re = new RegExp(pattern, "g"); var searchString = document.getElementById("incoming").value; var matchArray; var resultString = "<pre>"; var first = 0; var last = 0; while((matchArray = re.exec(searchString)) != null) { last = matchArray.index; resultString += searchString.substring(first, last); resultString += "<span class='found'>" + matchArray[0] + "</span>"; first = re.lastIndex; } resultString += searchString.substring(first, searchString.length); resultString += "</pre>"; document.getElementById("searchResult").innerHTML = resultString;
}
Developer | Honglio |
Username | honglio |
Uploaded | August 11, 2022 |
Rating | 3 |
Size | 2,165 Kb |
Views | 46,552 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by honglio | 2,701 Kb |
Pure CSS shape | 1,798 Kb |
CSS3 Contact Form | 3,866 Kb |
Bootstrap 3 Pool Archives | 1,865 Kb |
Bootstrap 3 Price Table | 2,655 Kb |
LocalStorage | 1,422 Kb |
Car Paint Tailor | 1,890 Kb |
Image2Canvas | 2,031 Kb |
CSS3 Hover Effects | 5,696 Kb |
A Clock example | 1,775 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Donald Trump - The New Yorker | Agbales | 2,502 Kb |
Simple search using AngularJS | Haykou | 1,802 Kb |
A Pen by Gregory Potdevin | GregoryPotdevin | 1,713 Kb |
A Pen by Stan Williams | Stanssongs | 6,706 Kb |
Website Concept | Sagoza | 3,104 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Mobile Nav Menu | AliKlein | 4,745 Kb |
Another brick in the wall | Fivera | 1,955 Kb |
Bubble animation | Ftabor | 6,565 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!