html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<!--This tutorial is inspired by TutorialsPoint please check them out.
The idea behind this was of Krishna Sir, to give extra knowledge
outside of SoloLearn course, Please check Krishna sir's code.
-->
<head>
<title>Regular Expressions</title>
</head>
<body>
<!--<input type="button" class="s" value="Home"
onclick="window.open('https://code.sololearn.com/WGTo30Bt14ds/#html')"/>
-->
<h1>Java - Regular Expressions</h1>
<p>Java provides the java.util.regex package for pattern matching with regular expressions.</p>
<p>A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data.</p>
<button onclick="myClass()"> <b>Hide/Show</b> information about Class</button>
<div style="display:none" id="myCla">
<p>The java.util.regex package primarily consists of the following three classes −</p>
<ul class="list">
<li><p><b>Pattern Class</b> − A Pattern object is a compiled representation of a regular expression. The Pattern class provides no public constructors. To create a pattern, you must first invoke one of its public static <b>compile()</b> methods, which will then return a Pattern object. These methods accept a regular expression as the first argument.</p></li>
<li><p><b>Matcher Class</b> − A Matcher object is the engine that interprets the pattern and performs match operations against an input string. Like the Pattern class, Matcher defines no public constructors. You obtain a Matcher object by invoking the <b>matcher()</b> method on a Pattern object.</p></li>
<li><p><b>PatternSyntaxException</b> − A PatternSyntaxException object is an unchecked exception that indicates a syntax error in a regular expression pattern.</p></li>
</ul>
</div>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
body, html {
width: 100%;
padding: 0;
margin: 0;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.s {
background : white;
width : 100%;
}
p {
display: block;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
p {
word-wrap: break-word;
}
ul {
list-style-type: none;
font-size: 12px;
padding: 3px;
font-family: Monaco,Menlo,Consolas,"Courier New",monospace;
display: inline-block;
border: 1px solid #ddd;
border-radius: 2px;
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
alert('Course content is from "tutorialspoint.com" check them out.\r\nCode idea is of Krishna sir.\r\nAdded example code.\r\nGive your suggestion to improve this code.');
function myClass() {
var x = document.getElementById('myCla');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
function mySyntax() {
var x = document.getElementById('mySyn');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
function myIndex() {
var x = document.getElementById('myInd');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
function myStudy() {
var x = document.getElementById('myStu');
if (x.style.display === 'none') {
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run