xxxxxxxxxx
import re
def search_pattern_in_html(pattern, input_html):
matches = re.findall(pattern, input_html)
return matches
# Example usage
html_string = '''
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is a sample paragraph.</p>
</body>
</html>
'''
pattern = r"<(.*?)>"
matches = search_pattern_in_html(pattern, html_string)
print(matches)
xxxxxxxxxx
<form action="/action_page.php" enctype="multipart/form-data" >
<label>Name</label>
<input type="text" name="name" pattern="[A-Za-z0-9]{3}" ><br><br>
<input type="submit">
</form>
xxxxxxxxxx
echo '<input type="text" maxlength="32" name="first_name" pattern="[A-Za-z]{1,32}" value="'.$_SESSION['user_first_name'].'" required>';
xxxxxxxxxx
// (?=.*[a-z]) ----> At least one lowercase letter(a - z)
// (?=.*[A-Z]) ----> At least one uppercase letter(A - Z)
// (?=.*[0-9]) ----> At least one number(0-9)
// (?=.*[!@#$%^&*_=+-]) ----> At least one special symbol(!@#$%^&*=+-_)
// {8,16} ----> {min, max}
<input type="password" pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$" />
xxxxxxxxxx
<form action="/action_page.php" enctype="multipart/form-data" >
<label>Name</label>
<input type="text" name="name" pattern="[A-Za-z]{3}" ><br><br>
<input type="submit">
</form>
xxxxxxxxxx
import re
def find_pattern(pattern, input_text):
matches = re.findall(pattern, input_text)
return matches
input_text = "This is an example input. It has a pattern ABC123."
pattern = r'\b[A-Z]{3}\d{3}\b' # Example pattern to find three capital letters followed by three digits
results = find_pattern(pattern, input_text)
print(results)