Hongmu Notes
Home Language Notes Summary of commonly used Bootstrap 5 form `pattern` attribute
Language Notes Bootstrap

Summary of commonly used Bootstrap 5 form `pattern` attribute

Summary of commonly used Bootstrap 5 form `pattern` attribute

Common Bootstrap 5 form templates pattern Attribute Summary:

  • Validation Text Box: Checks whether the value in the validation text box matches the specified regular expression. For example,pattern="[a-zA-Z]{3,}$" This indicates that the verification string must contain at least three letters, and the last character cannot be a digit or a space.
  • Password Verification Field: Checks whether the value in the Password Verification Field matches the specified regular expression. For example,pattern="(?=.*[a-zA-Z])(?=.*\\d)(?=.*[!@#$%^&*()_+])[a-zA-Z\\d!@#$%^&*()_+]{8,}$" The password must contain at least one letter, one digit, and one special character, and must be at least 8 characters long.
  • Email Validation Field: Checks whether the value in the Email Validation Field matches the specified regular expression. For example,pattern="^([a-zA-Z0-9_\.-]+)@([\da-zA-Z\.-]+)\.([a-zA-Z\.]{2,6})$" The email address must consist of letters, digits, dots, underscores, or dashes; however, a dot cannot appear at the beginning or the end of the email address.
  • Mobile phone number verification field: Verify whether the value in the mobile phone number verification field matches the specified regular expression. For example,pattern="^1[3|4|5|6|7|8|9][0-9]{9}$" The mobile phone number must start with a digit, followed by one of the digits 3, 4, 5, 6, 7, 8, or 9; the number must be 11 digits long.
  • Verify URL Field: Checks whether the value in the Verify URL Field matches the specified regular expression. For example,pattern="^(https?|ftp|ssh)://[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" The URL must use the HTTPS protocol; it must start with https://, http://, or ftp://; and the URL length must not exceed 2000 characters.
  • Date format validation: Checks whether the date format matches the specified regular expression. For example,pattern="^([0-9]{2}-[0-9]{2}-[0-9]{4})$" The date must be entered in the year–month–day format.
  • Verify time format: Check whether the time format matches the specified regular expression. For example,pattern="^([0-9]{2}-[0-9]{2}-[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}Z)$" The time must be entered in the format Year-Month-Day H:M:S.

In addition to the above-mentioned uses,pattern The attribute can also be used in other ways, depending on the specific application scenario.

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Bootstrap5 container document translation

Bootstrap5 container document translation Language Notes Bootstrap

Containers are the fundamental building blocks of Bootstrap; they are used to contain, fill, and align content within a specific device or viewport. Containers are the most basic layout elements in Bootstrap and are essential when using our default grid system. They are used to hold, fill, and (sometimes) center content. While containers can be nested, most layouts do not require nested containers. Bootstrap comes with three types of containers...
👁 189
Use of bootstrap5 accordion

Use of bootstrap5 accordion Language Notes Bootstrap

Parent Container: Class name: `accordion`; ID: `accordionExample` – The `data-bs-parent` attribute of the child accordion container must match the ID of the parent container. Child Item: Class name: `accordion-item`; Child Item Header: Class name: `Accordion-header`; ID: `headingOne`; The `aria-label` attribute of the child item content container...
👁 174

Recommended reading

Responsive Landscape Architecture Design Company Website Template 0700

Responsive Landscape Architecture Design Company Website Template 0700 Practical Collection Yiyou template

An eyouCMS responsive website template designed specifically for landscape architecture firms. Its natural and artistic design style is ideal for showcasing landscape design projects, garden engineering case studies, and plant arrangement plans. This template helps landscape design companies attract high-end project clients online. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for YououCMS | YououCMS...
👁 50
273 phrases that describe people’s expressions

273 phrases that describe people’s expressions Hobbies

The summarizing phrase is really, really practical! Brows furrowed, eyes flashing, frowning slightly, gazing affectionately, smiling, face blurred, bright eyes, indifferent expression, wide-eyed, smiling, lowered eyes, confused, worried, frowning, clenching teeth in pain, gently licking lips, smiling, eyes full of expectation, blinking innocently, pursed lips, tears filling eyes, looking tenderly, eyes full of anger, furrowed brows, nodding gently, smiling with expressionless eyes...
👁 129
(Adaptive Mobile Version) Electric Hoist Website Template – Download Crane Equipment Website Source Code – 1121

(Adaptive Mobile Version) Electric Hoist Website Template – Download Crane Equipment Website Source Code – 1121 Practical Collection pbootcms Template

An electric hoist and lifting equipment website template (PbootCMS), compatible with both PC and WAP devices. The professional industrial design is ideal for showcasing electric hoists, lifting machinery products, and project cases. It helps lifting equipment manufacturers showcase their products online and attract industrial and construction clients. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 52
PHP implode() function

PHP implode() function Language Notes PHP

The function combines array elements into a single string: <code>PHP arr = array('Hello', 'World!', 'I', 'love', 'Shanghai!'); echo implode(", arr);</code>
👁 175
(Adaptive mobile version) PBootCMS template for flower shop and fresh flower delivery websites; Download source code for floral and gardening websites – 0393

(Adaptive mobile version) PBootCMS template for flower shop and fresh flower delivery websites; Download source code for floral and gardening websites – 0393 Practical Collection pbootcms Template

This adaptive mobile-friendly website template is designed for flower shop delivery services and floral gardening, powered by PbootCMS. Its fresh and elegant design is ideal for showcasing floral products, floral arrangements, and delivery services. It helps flower shops attract both individual and corporate customers online while enhancing their brand image. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles...
👁 40
Seedling and Lawn Greening Planting Website Template 0701

Seedling and Lawn Greening Planting Website Template 0701 Practical Collection Yiyou template

This EyouCMS template is ideal for the nursery stock, lawn care, and landscaping industry. Its natural and fresh design style effectively showcases nursery products, lawn installation projects, and landscaping maintenance services. It helps landscaping businesses demonstrate their expertise online and expand their business reach. Template Preview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (Eyou...
👁 33