Tartışmalar » Geliştirme

Help Need regexp for Quora.com (for namespace regexp'"XXX")

§
Gönderildi: 18.09.2022
Düzenlendi: 18.09.2022

For my userscript /CSS:
Quora.com Without Limit


I need a regexp which match too pages like that (where quora.com is not at beginning of the URL):
https://questionsmilitaires.quora.com/?share=1
https://quorafr.quora.com/

I make a test but it's not working :
regexp("/(quora.com)")

NotYouMod
§
Gönderildi: 19.09.2022
Düzenlendi: 19.09.2022

You can easily do that with JS. (That will be faster than regular expressions)

(function() {
  if(location.host === 'boards.greenhouse.io' || location.host.indexOf('quora.com') > -1) {
    let css = `
    /* Your CSS Code */
    `
    let style = document.createElement('style')
    style.appendChild(document.createTextNode(css))
    document.querySelector('head').appendChild('style')
  }
})()
§
Gönderildi: 19.09.2022

Nice, but i need for my userstyle too..
And the install as userscript of Greasyfork convert it after.

Just for curiosity:
Why "location.host === 'boards.greenhouse.io'" ?

§
Gönderildi: 20.09.2022
Düzenlendi: 20.09.2022

Thank!
Regexp are not my taste of tea ....

From:
https://forum.userstyles.org/discussion/52343/how-to-use-the-regexp
Regexp rules should be a valid regular expression which will be tested against the entire URL.
- Regexps must be enclosed in quotes.
- Backslashes "/"must be escaped according to CSS rules.
- Regexp wildcards are permitted.

Your good rexp in regex101 Online Tool (https://regex101.com/r/ZKnDnR/1), is:

/^https:\/\/(?!quora.com*)\S+\/*/gm

I test (after Backslashes "/" escaped):
@-moz-document domain("www.quora.com"), url-prefix("https://quora.com"), regexp('^https:\\/\\/(?!quora.com*)\\S+\\/*')

And YES, that's GOOD!

Thanks a lot.
I hope it match all these different url i found in future...

Note :
I don't understand the logic of Quora:
- Many different url
- Its design is strange (too wide image by example)

And at least without login:
- Nag screen with blurry contents
- No search:
but i made an Ready2Search(Quora in site search DukDukGo) for it.


But their are some interesting things in it...

§
Gönderildi: 21.09.2022
Düzenlendi: 21.09.2022

Problem:
I notice the script (v.4) and its userstyle version are applied to all sites...

A regexp problem ?

§
Gönderildi: 21.09.2022

tophf found the good and simple solution:
RegEx Help #1476

I need just:
@-moz-document domain(quora.com)

Simply....

Cevap paylaş

Yanıt göndermek için oturum açın.