Learning Objectives: to count how many HTML class attributes in your webpage document.
Practise this following lesson using your computer:
- Open Notepad++.
- Type this following source code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
.city {
background-color: tomato;
color: white;
border: 2px solid black;
margin: 20px;
padding: 20px;
}
</style>
</head>
<body>
<div class="city">
<h2>London</h2>
<p>London is the capital of England.</p>
</div>
<div class="city">
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
</div>
<div class="city">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
</div>
</body>
</html> - Click Search > Find... menu.
- Ensure you are in the Find tab.
- Type this in Find what:
(<.+? )(?<!>)(class)?=".+?"
or
(class)?=".+?"(?!<)(?=.*?) - Check list the Wrap around.
- In Search Mode, choose Regular expression (on the below).
- press Count button.
- It will be display how many class attributes in Find dialogue box status bar.
Notes: you can use the other tools beside Notepad++, to use Regular expression.
text editor, notepad plus plus, regular expression editor, regex editor, regex tools, ellipsis
Bibliography
https://foundry.co/
https://notepad-plus-plus.org/
https://www.hostinger.co.id/
https://www.linguisticsweb.org/
https://www.w3schools.com/
Tidak ada komentar:
Posting Komentar