ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
330 stars 37 forks source link

Is there a way to get a part of the page url? #513

Closed runningcheese closed 2 years ago

runningcheese commented 2 years ago

As we know that {searchTerms} is stand for page url when you search a website.

but, is there a way to get a part of the page url?

for example:

https://space.bilibili.com/330821611/video

i would like to get the number 330821611,not the full url.

this picture is what i am trying to add.

iShot2022-07-21 11 34 44

I know that it will be complicated, so thanks in advance.

ssborbis commented 2 years ago

Yeah, use the Modify Terms Regex field. It allows you to alter the searchTerms before they're sent to the command.

/.*?(\d+)\/.*/$1/g

runningcheese commented 2 years ago

@ssborbis that is awesome, man!!!

runningcheese commented 2 years ago

@ssborbis what about this one? to match the second number 1445680654 https://space.bilibili.com/11499954/favlist?fid=1445680654

ssborbis commented 2 years ago

Probably something like:

/.*=(\d+)$/$1/g

Plenty of resources out there on regex matching.

https://regex101.com/

runningcheese commented 2 years ago

So, the ContextSearch-web-ext regex is the same as normal regex, i thought it's different, thanks anyway!

runningcheese commented 2 years ago

and i am wondering what is the time next realese comes up? thanks for your great work!

ssborbis commented 2 years ago

if you're on Firefox, you can install the release candidate I just signed.

https://github.com/ssborbis/ContextSearch-web-ext/releases/download/1.40beta/contextsearch_web_ext-1.40rc1.xpi

ssborbis commented 2 years ago

1.41 is live

runningcheese commented 2 years ago

1.41 is live @ssborbis

It's a great improvement, thanks for your kind work! And i have made a full introduction to my following fans! Hang in there!