M
M
Mosapi2020-04-28 12:05:18
JavaScript
Mosapi, 2020-04-28 12:05:18

How to set a page to execute a script through regular expressions?

It is necessary that the script is executed only on pages of a certain type.
For a static page, I do this:

let path = window.location.href;
let opt = !path || path === 'url website';

And it works great, but I need the script to be executed on pages at this address
https://website.ru/search?results%5Btable%5D=85&results%5Bfilters%5D%5B0%5D%5Bfield%5D=0&results%5Bfilters%5D%5B0%5D%5Bvalue%5D=число любой длинны&results%5Bfilters%5D%5B1%5D%5Bfield%5D=104


Tried to substitute a regular expression such, but does not work. (where the inscription is a number of any length)
/[0-9]{7}/g
Not perceived.
In general, you can use regular expressions in the address, and how to specify it correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question