Match patterns أنماط المطابقة

Match patterns are a way to specify groups of URLs: a match pattern matches a specific set of URLs. They are used in WebExtensions APIs in a few places, most notably to specify which documents to load content scripts into, and to specify which URLs to add webRequest listeners to.
أنماط المطابقة هي طريقة لتحديد مجموعات من عناوين URL: يتطابق نمط المطابقة مع مجموعة محددة من عناوين URL. يتم استخدامها في واجهات برمجة تطبيقات WebExtensions في أماكن قليلة ، وعلى الأخص لتحديد المستندات التي سيتم تحميل البرامج النصية للمحتوى فيها ، ولتحديد عناوين URL التي يجب إضافة webRequest المستمعين إليها.

APIs that use match patterns usually accept a list of match patterns, and will perform the appropriate action if the URL matches any of the patterns. See, for example, the content_scripts key in manifest.json.
عادة ما تقبل واجهات برمجة التطبيقات التي تستخدم أنماط المطابقة قائمة بأنماط المطابقة، وستنفذ الإجراء المناسب إذا تطابق عنوان URL مع أي من الأنماط. انظر ، على سبيل المثال ، content_scripts المفتاح في manifest.json.

Match pattern structure  بنية نمط المطابقة

Note: Some browsers don't support certain schemes. Check the Browser compatibility table for details.
ملاحظة: لا تدعم بعض المتصفحات أنظمة معينة. راجع جدول توافق المتصفح للحصول على التفاصيل.

All match patterns are specified as strings. Apart from the special <all_urls> pattern, match patterns consist of three parts: scheme, host, and path. The scheme and host are separated by ://.
يتم تحديد جميع أنماط المطابقة كسلاسل. بصرف النظر عن النمط الخاص <all_urls> ، تتكون أنماط المطابقة من ثلاثة أجزاء: المخطط والمضيف والمسار. يتم فصل المخطط والمضيف بواسطة :// .

<scheme>://<host><path>

scheme  نظام

The scheme component may take one of two forms:
قد يتخذ مكون المخطط أحد شكلين:

Form شكل Matches مباريات
* Only "http" and "https" and in some browsers also "ws" and "wss".
فقط "http" و "https" وفي بعض المتصفحات أيضا "ws" و "wss".
One of http, https, ws, wss, ftp, data, file, or (chrome-)extension.
واحد من http ، https ، ws ، wss ftp ، data ، file ، ، أو (chrome-)extension .
Only the given scheme.
فقط المخطط المحدد.

host  مضيف

The host component may take one of three forms:
قد يتخذ المكون المضيف أحد الأشكال الثلاثة:

Form شكل Matches مباريات
* Any host. أي مضيف.
*. followed by part of the hostname.
*. متبوعا بجزء من اسم المضيف.
The given host and any of its subdomains.
المضيف المحدد وأي من نطاقاته الفرعية.
A complete hostname, without wildcards.
اسم مضيف كامل ، بدون أحرف بدل.
Only the given host.
فقط المضيف المحدد.

host must not include a port number.
يجب ألا يتضمن المضيف رقم منفذ.

host is optional only if the scheme is "file".
المضيف اختياري فقط إذا كان المخطط "ملف".

Note that the wildcard may only appear at the start.
لاحظ أن حرف البدل قد يظهر فقط في البداية.

path  مسار

The path component must begin with a /.
يجب أن يبدأ مكون المسار ب / .

After that, it may subsequently contain any combination of the * wildcard and any of the characters that are allowed in URL paths or query strings. Unlike host, the path component may contain the * wildcard in the middle or at the end, and the * wildcard may appear more than once.
بعد ذلك ، قد يحتوي لاحقا على أي مجموعة من حرف البدل * وأي من الأحرف المسموح بها في مسارات URL أو سلاسل الاستعلام. على عكس المضيف ، قد يحتوي مكون المسار على حرف البدل * في المنتصف أو في النهاية ، وقد يظهر حرف البدل * أكثر من مرة.

The value for the path matches against the string which is the URL path plus the URL query string. This includes the ? between the two, if the query string is present in the URL. For example, if you want to match URLs on any domain where the URL path ends with foo.bar, then you need to use an array of Match Patterns like ["*://*/*foo.bar", "*://*/*foo.bar?*"]. The ?* is needed, rather than just bar*, in order to anchor the ending * as applying to the URL query string and not some portion of the URL path.
تتطابق قيمة المسار مع السلسلة التي هي مسار URL بالإضافة إلى سلسلة استعلام URL. يتضمن ذلك ? بين الاثنين ، إذا كانت سلسلة الاستعلام موجودة في عنوان URL. على سبيل المثال ، إذا كنت تريد مطابقة عناوين URL على أي مجال ينتهي فيه مسار عنوان URL ب foo.bar ، فأنت بحاجة إلى استخدام مجموعة من أنماط المطابقة مثل ["*://*/*foo.bar", "*://*/*foo.bar?*"] . هناك ?* حاجة ، وليس فقط bar* ، من أجل تثبيت النهاية * على أنها تنطبق على سلسلة استعلام URL وليس جزءا من مسار URL.

Neither the URL fragment identifier, nor the # which precedes it, are considered as part of the path.
لا يعتبر معرف جزء عنوان URL ولا # الذي يسبقه جزءا من المسار.

Note: The path pattern string should not include a port number. Adding a port, as in: http://localhost:1234/* causes the match pattern to be ignored. However, http://localhost:1234 will match with http://localhost/*.
ملاحظة: يجب ألا تتضمن سلسلة نمط المسار رقم منفذ. تؤدي إضافة منفذ، كما في: http://localhost:1234/* إلى تجاهل نمط التطابق. ومع ذلك ، http://localhost:1234 سوف تتطابق مع http://localhost/* .

<all_urls>

The special value <all_urls> matches all URLs under any of the supported schemes: that is "http", "https", "ws", "wss", "ftp", "data", and "file".
تتطابق القيمة <all_urls> الخاصة مع جميع عناوين URL ضمن أي من المخططات المدعومة: أي "http" و "https" و "ws" و "wss" و "ftp" و "data" و "file".

  امثله

 رسم  أمثلة على التطابقات  مثال على حالات عدم التطابق

<all_urls>

 تطابق جميع عناوين URL.

http://example.org/

https://a.org/some/path/

ws://sockets.somewhere.org/

wss://ws.example.com/stuff/

ftp://files.somewhere.org/

resource://a/b/c/
 (مخطط غير مدعوم)

ftps://files.somewhere.org/
 (مخطط غير مدعوم)

*://*/*


تطابق جميع عناوين URL HTTP و HTTPS و WebSocket.

http://example.org/

https://a.org/some/path/

ws://sockets.somewhere.org/

wss://ws.example.com/stuff/

ftp://ftp.example.org/
 (مخطط لا مثيل له)

file:///a/
 (مخطط لا مثيل له)

*://*.mozilla.org/*


تطابق جميع عناوين URL HTTP وHTTPS وWebSocket المستضافة في "mozilla.org" أو أحد نطاقاتها الفرعية.

http://mozilla.org/

https://mozilla.org/

http://a.mozilla.org/

http://a.b.mozilla.org/

https://b.mozilla.org/path/

ws://ws.mozilla.org/

wss://secure.mozilla.org/something

ftp://mozilla.org/
 (مخطط لا مثيل له)

http://mozilla.com/
 (مضيف لا مثيل له)

http://firefox.org/
 (مضيف لا مثيل له)

*://mozilla.org/


تطابق جميع عناوين URL HTTP و HTTPS و WebSocket المستضافة في "mozilla.org/" بالضبط.

http://mozilla.org/

https://mozilla.org/

ws://mozilla.org/

wss://mozilla.org/

ftp://mozilla.org/
 (مخطط لا مثيل له)

http://a.mozilla.org/
 (مضيف لا مثيل له)

http://mozilla.org/a
 (مسار لا مثيل له)

ftp://mozilla.org/


تطابق فقط "ftp://mozilla.org/".

ftp://mozilla.org

http://mozilla.org/
 (مخطط لا مثيل له)

ftp://sub.mozilla.org/
 (مضيف لا مثيل له)

ftp://mozilla.org/path
 (مسار لا مثيل له)

https://*/path


تطابق عناوين URL ل HTTPS على أي مضيف ، يكون مساره هو "المسار".

https://mozilla.org/path

https://a.mozilla.org/path

https://something.com/path

http://mozilla.org/path
 (مخطط لا مثيل له)

https://mozilla.org/path/
 (مسار لا مثيل له)

https://mozilla.org/a
 (مسار لا مثيل له)

https://mozilla.org/
 (مسار لا مثيل له)

https://mozilla.org/path?foo=1

(مسار غير مطابق بسبب سلسلة استعلام URL)

https://*/path/


تطابق عناوين URL ل HTTPS على أي مضيف يكون مساره "path/" ولا يحتوي على سلسلة استعلام URL.

https://mozilla.org/path/

https://a.mozilla.org/path/

https://something.com/path/

http://mozilla.org/path/
 (مخطط لا مثيل له)

https://mozilla.org/path
 (مسار لا مثيل له)

https://mozilla.org/a
 (مسار لا مثيل له)

https://mozilla.org/
 (مسار لا مثيل له)

https://mozilla.org/path/?foo=1

(مسار غير مطابق بسبب سلسلة استعلام URL)

https://mozilla.org/*


تطابق عناوين URL ل HTTPS فقط عند "mozilla.org"، مع أي مسار عنوان URL وسلسلة استعلام عنوان URL.

https://mozilla.org/

https://mozilla.org/path

https://mozilla.org/another

https://mozilla.org/path/to/doc

https://mozilla.org/path/to/doc?foo=1

http://mozilla.org/path
 (مخطط لا مثيل له)

https://mozilla.com/path
 (مضيف لا مثيل له)

https://mozilla.org/a/b/c/


طابق عنوان URL هذا فقط أو عنوان URL هذا مع أي جزء من عنوان URL.

https://mozilla.org/a/b/c/

https://mozilla.org/a/b/c/#section1

 أي شيء آخر.

https://mozilla.org/*/b/*/


تطابق عناوين URL ل HTTPS المستضافة على "mozilla.org" ، والتي يحتوي مسارها على مكون "b" في مكان ما في المنتصف. سيطابق عناوين URL مع سلاسل الاستعلام، إذا كانت السلسلة تنتهي ب / .

https://mozilla.org/a/b/c/

https://mozilla.org/d/b/f/

https://mozilla.org/a/b/c/d/

https://mozilla.org/a/b/c/d/#section1

https://mozilla.org/a/b/c/d/?foo=/

https://mozilla.org/a?foo=21314&bar=/b/&extra=c/

https://mozilla.org/b/*/
 (مسار لا مثيل له)

https://mozilla.org/a/b/
 (مسار لا مثيل له)

https://mozilla.org/a/b/c/d/?foo=bar

(مسار غير مطابق بسبب سلسلة استعلام URL)

file:///blah/*


تطابق أي عنوان URL لملف يبدأ مساره ب "blah".

file:///blah/

file:///blah/bleh

file:///bleh/
 (مسار لا مثيل له)

  أنماط المطابقة غير الصالحة

 نمط غير صالح  سبب
resource://path/  مخطط غير مدعوم.
https://mozilla.org  لا يوجد مسار.
https://mozilla.*.org/
يجب أن يكون "*" في المضيف في البداية.
https://*zilla.org/
يجب أن يكون "*" في المضيف هو الحرف الوحيد أو أن يتبعه ".".
http*://mozilla.org/
يجب أن يكون "*" في المخطط هو الحرف الوحيد.
https://mozilla.org:80/
يجب ألا يتضمن المضيف رقم منفذ.
*://*
مسار فارغ: يجب أن يكون هذا " *://*/* ".
file://*
مسار فارغ: يجب أن يكون هذا " file:///* ".

  توافق المتصفح


الإبلاغ عن مشاكل في بيانات التوافق هذه على GitHub
 سطح المكتب جوال
 كروم
 حافة
 فايرفوكس
 أوبرا
 سفاري
 فايرفوكس للأندرويد
 سفاري على دائرة الرقابة الداخلية
data
file
ftp
http
https

مخطط أحرف * البدل

* المباريات ws و wss
ws
wss

Legend


معلومه- سرية: يمكنك النقر / النقر فوق خلية لمزيد من المعلومات.

Full support
 دعم كامل
Partial support
 دعم جزئي
No support
 لا يوجد دعم