Page 321 - CITS - CSA - TP (Volume 1) - Hindi
P. 321
कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS
अ ास 58: िनयिमत अिभ का दश न - बुिनयादी िनयिमत अिभ याँ, PCRE, मैिचंग पैटन ,
फाइंिडंग मैच, पैटन बदलना, मोडीफायर , ेकअप ं (Demonstrate Regular
Expressions - The basic regular expressions, PCRE, Matching patterns, Finding
matches, Replace patterns, Modifiers, Breakup Strings)
उ े
इस अ ास के अंत म आप यह कर सक गे
• PHP म बुिनयादी िनयिमत अिभ यों का उपयोग कर
• PHP म PCRE फ़ं न का उपयोग कर ।
आव कताएं (Requirements)
औजार/साम ी (Tools/Materials)
• लेटे कॉ फ़गरेशन वाला कं ूटर/लैपटॉप • PHP
• ऑपरेिटंग िस म: िवंडोज़ 10 या 11 • टे एिडटर
• apache वेब सव र • वेब ाउज़र
ि या (Procedure)
टा 1: बुिनयादी िनयिमत अिभ यों के साथ काय करना
I िसंगल करै र को मैच करना (Matching a single character)
1 टे एिडटर ओपन कर
2 िन िल खत कोड िलख
<html >
<head>
<title > Matching a single character </title>
</head>
<body>
<?php
$string = “Hello, world!”;
$pattern = “/w/”; // Matches any word character (alphanumeric or underscore)
if (preg_match($pattern, $string))
{
echo “Match found!”; // Output: Match found!
}
?>
</body>
</html>
3 ो ाम को C:\Apache24\htdocs म .php ए ट शन वाले फ़ो र म सेव कर
4 Apache सिव स को िवंडोज़ सिव स से रन कर
5 ाउज़र ओपन कर और िन एड ेस टाइप कर
305

