How to do querySelector with wildcard match?

In a DOM element search sometimes it is necessary to use a wildcard match with querySelector and querySelectorAll. In some cases, we may need a particular query to the name attribute of the element.

We can consider the following with querySelector and querySelectorAll.

[id^='elementId'] will match all ids starting with elementId.
[id$='elementId'] will match all ids ending with elementId.
[id*='elementId'] will match all ids containing elementId.

https://stackoverflow.com/questions/8714090/queryselector-wildcard-element-match