Article View: news.software.readers
Article #264624Re: [40tude] Edit -> Find regular expression?
From: VanguardLH
Date: Thu, 21 Jan 2021 00:53
Date: Thu, 21 Jan 2021 00:53
117 lines
6162 bytes
6162 bytes
mike <this@address.is.invalid> wrote:
> 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.
When you hit F to bring up the Find dialog, and made sure to pick the
"Article body pane" tab, did you also make sure to select the "Regular
expressions" option? Without that option, you would be searching on the
ASCII string of \x{201C} instead of a searching by a regex specifying an
escaped x followed by the braced numeric value for the Unicode char.
F (to show Find dialog).
Select "Article body" tab.
Select the "Regular expressions" option.
Enter "\x{201C}.*\x{201D}" (sans quotes) in the "Text to find" field.
Pick where to search: selected groups, all groups, selected body.
The search proceeds forward, not from the top. If you are past the
group or message with the doubled quotes, the search finds the *next*
article, if any, that has those characters. The search does not loop
around back to the top after reaching the bottom of the list.
Technical Details
Message-ID:
<1gf2aqovcfhb8.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-mailReferences:
<ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <ruagkd$j08$1@solani.org>Show Full Headers
Complete Article Headers
Message-ID: <1gf2aqovcfhb8.dlg@v.nguard.lh> Subject: Re: [40tude] Edit -> Find regular expression? Date: Wed, 20 Jan 2021 18:53:13 -0600 From: VanguardLH <V@nguard.LH> References: <ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <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-mail Newsgroups: news.software.readers Organization: Usenet Elder Lines: 117 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: individual.net tNwKQZ/QXrj6cSBlVdkq2gHkMPozKg+PyXTxOY5CxeaV/16ua+ Keywords: VanguardLH VLH811 Cancel-Lock: sha1:mVq45lKLsoaAgJLB9Ti1uL7BXNs= User-Agent: 40tude_Dialog/2.0.15.41