User:V111P/js/WebRef: Difference between revisions

Content deleted Content added
How to create the bookmarklet: Mac Chrome instructions
moving a user comment to the talk page
Line 40:
 
The caveat is that these words, after ^^, can be [[regular expression]]s. What that means is to use the characters '''\ . ? * + | ^ $ ( ) [ ] { }''' you need to prepend them with <code>\</code>. Otherwise they have special meanings. A period for examples means "any one character". An example: we want to remove everything after the first period: <code>span.byline-name^^^^\.</code> - here we use <code>\</code> to escape the special-character meaning of the period.
 
==Not escaping spaces in URLs properly?==
I've noticed that spaces in URL's often don't get escaped properly. For example:
<pre>
<ref name="book_TheB">{{Cite web
| title = The Bronx, in Bits and Pieces
| author =
| work = Google Books
| date =
| accessdate = 2018-02-03
| url = https://books.google.com/books?id=WeVTP3GyFH0C&pg=PA175&lpg=PA175&dq=faile+mansion&source=bl&ots=Gi_ATxuIsJ&sig=nMvLUfi4Y0Ckl8G377s-9IspZqA&hl=en&sa=X&ved=2ahUKEwiC78nhzofZAhWKxFkKHW3nCBgQ6AEwDnoECAsQAQ#v=onepage&q=faile mansion&f=false
| language =
| quote =
}}</ref>
</pre>
 
The url field has ''q=faile mansion''. The embedded space should be escaped to a + (or maybe some %hex code).
 
Other than that, this is a truly awesome tool. Thanks for making it available! -- [[User:RoySmith|RoySmith]] [[User Talk:RoySmith|(talk)]] 15:54, 3 February 2018 (UTC)
 
== See also ==