Article View: news.software.readers
Article #264623Re: [40tude] Edit -> Find regular expression?
From: mike
Date: Thu, 21 Jan 2021 00:07
Date: Thu, 21 Jan 2021 00:07
98 lines
5197 bytes
5197 bytes
wrote:
> Since all the headers are ASCII characters (I think there is some
> encoding prefix identifier for the Subject header, but the string itself
> is all ASCII), you must be trying to find the curly quoted strings in
> the body of message. Make sure when you use Edit -> Find that you
> select the "Article body pane" tab in the Find dialog.
Yes. Body. When I cut and paste from various sources (usually web pages) I
want consistency in the quoting so that every cut and paste uses the
simplest consistent type of straight quotes and single dashes (why they
think we need even bigger dashes is lost on me).
Here's an example of something I might cut and paste into the body
https://www.lifewire.com/typing-quotes-apostrophes-and-primes-1074104
https://typographyforlawyers.com/straight-and-curly-quotes.html
https://usefulangle.com/post/217/html-curly-quotes
https://www.enotes.com/homework-help/what-are-two-quotes-from-curley-in-of-mice-and-men-302038
> Why do you think Dialog's Edit -> Find function has a replace operation?
> It just finds. It does not replace. To replace means another field
> would have to be included to show with just what to replace the found
> substring. Edit -> Find has only one input field: "Text to find".
> There is no "[Text to] replace with" field.
> Or do you mean you'll use the Find function, and then manually edit the
> found string?
My mistake for not being clear that I press control F to find and then I
repeatedly press F3 as many times as needed to find more, and then as it is
finding these things, I replace manually by typing the straight doublequote
(or the straight singlequote) to replace the curly characters (and then move
on using F3 until I get to the end).
> You could do a regex search using:
>
> ´.*¡
>
> The dot (.) means any character, and the * means zero, or more, of any
> character. The above would find:
>
> ´¡
> ´X¡
> ´abc def. Right you are!¡
> However, regex rules are plain text, so you won't be able to add the
> curly quotes to a rule. You'll need to use the encoded or numeric value
> for the characters. My recollection is regex in Dialog uses the PCRE
> variant.
> https://www.regular-expressions.info/unicode.html
>
> You would have to replace the curly quotes with their Unicode
> equivalents. From the above article, PCRE does not handle \uFFFF to
> specify the hexidecimal number for a Unicode character. Instead you use
> \x{FFFF} (include the curly braces).
>
> 201C = left curly quote character
> 201D = right curly quote character
>
> So, my guess is you would use the following regex to find (not replace)
> any string of zero, or more, characters where the order is left curly,
> followed by zero or more characters, followed by a right curly, and
> probably looks like:
>
> \x{201C}.*\x{201D}
When I typed "control + f" and then pasted that "\x{201C}.*\x{201D}"
(without the quotes), it didn't find the curly quotes.
What's the key sequence to enter those special characters?
> I don't know of any posts that use the double curly quote characters,
> but as a test I did a Find on the straight double quote characters, like
> the "Edit -> Find" string in your post. I opened the Find dialog,
> selected the "Article body pane" tab, and searched on:
>
> \x{0022}.*\x{0022}
I pasted something from here
https://typographyforlawyers.com/straight-and-curly-quotes.html
and then I tried to type what you suggested but I must be missing a special
character as I cut and pasted exactly what you wrote above and it found only
what you wrote above but not what I pasted.
control
f
(then I pasted)\x{0022}.*\x{0022}
(then I pressed)OK
Dialog said - Search term "\x{0022}.*\x{0022}" not found.
> 0022 is the hex Unicode value of the double straight quote ("). It
> found your string in your post. I could've used " to make it easier,
> but I wanted to test using the Unicode encoded format to specify the
> straight double quote character.
Can you just let me know HOW to type the \x{0022} stuff?
I must be missing a key on my keyboard as I pasted it exactly as you wrote
it but it found only itself. I must have missed a critical step.
Technical Details
Message-ID:
<ruagkd$j08$1@solani.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh>Show Full Headers
Complete Article Headers
Message-ID: <ruagkd$j08$1@solani.org> Subject: Re: [40tude] Edit -> Find regular expression? Date: Thu, 21 Jan 2021 05:37:41 +0530 From: mike <this@address.is.invalid> References: <ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Injection-Date: Thu, 21 Jan 2021 00:07:42 -0000 (UTC) Injection-Info: solani.org; logging-data="19464"; mail-complaints-to="abuse@news.solani.org" Newsgroups: news.software.readers User-Agent: 40tude_Dialog/2.0.15.41 (0c24496a.39.280) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii" Mime-Version: 1.0 Cancel-Lock: sha1:v9IT4Tv0YH6dS1AUuHSz1KfYm4U= X-User-Id: eJwFwYEBgDAIA7CXBNrCzhko/59gwpBpEqLA5Vqg2uyAI949bafow8net+SdlR8SoduSXXh4VT54c46N/y7dFFU=