Input URL pattern attribute

Definition and Usage

pattern Attribute sets or returns the value of the pattern attribute of the URL field.

The HTML pattern attribute specifies a regular expression used to check the value of the URL field.

Tip:Use global HTML title attribute or DOM title Use attributes to describe the pattern to help users.

See also:

JavaScript Tutorial:Regular Expressions

JavaScript Reference Manual:RegExp Object

HTML Reference Manual:HTML <input> pattern অপারিতা

Example

Example 1

Get the value of the pattern attribute of the URL field:

var x = document.getElementById("myURL").pattern;

Try it yourself

Example 2

Set the URL field pattern to accept only URLs starting with http(s)://www.w3vip.cn/:

document.getElementById("myURL").pattern = "http://www\.w3vip\.cn\/(.+)|https://www\.w3vip\.cn\/(.+)";

Try it yourself

Syntax

return pattern attribute:

urlObject.pattern

set pattern attribute:

urlObject.pattern = regexp

প্রতিমান মান

মান বর্ণনা
regexp চেক করা URL ফিল্ড মানের প্রতিমান রূপান্তর

প্রযুক্তিগত বিবরণ

ফলাফল: শব্দচিহ্ন মান, যা প্রতিমান রূপান্তর

ব্রাউজার সমর্থন

চ্রোম এজ ফায়ারফক্স স্যাফারি অপেরা
চ্রোম এজ ফায়ারফক্স স্যাফারি অপেরা
সমর্থন 10.0 সমর্থন সমর্থন না সমর্থন