I have just started using a database on my local drive. I would like to know how I would use a regex commands to search the data in my database.
PS: I am a beginner, I have just started coding since last week.
My code so far:
<?php
error_reporting(0);
session_start(oid);
require 'view/header.php';
?>
<?php
?>
<form action="" method="post">
<h4>Insert a regex command below</h4>
Regex: <input type="text" name="regex"/>
<input type="submit" value="Search"/><br/><br/>
</form>
<?php
$regex=$_POST["regex"];
if(!empty("regex")) {
if(preg_match($regex, "Hello, my name is Hasan!")) {
echo "That is correct";
} else {
echo "That is incorrect";
}
}
?>
<?php
require 'view/footer.php';
?>
Any feedback is welcome. I am in the beginning stages of learning this.