Greasy Fork is available in English.

議論 » 開発

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

§
投稿日: 2022/09/18
編集日: 2022/09/18

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
§
投稿日: 2022/09/19
編集日: 2022/09/19

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')
  }
})()
§
投稿日: 2022/09/19

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'" ?

§
投稿日: 2022/09/20
編集日: 2022/09/20

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...

§
投稿日: 2022/09/21
編集日: 2022/09/21

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

A regexp problem ?

§
投稿日: 2022/09/21

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

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

Simply....

返信を投稿

返信を投稿するにはログインしてください。