[Dropped] Search and replace this
[Dropped] Search and replace this
I am trying to quickly edit several hundred email addresses in a text file. Here is a fictitious example.
I want to find and replace the first set of quotation marks and everything following up to and including the > ....(that is all of this " John.Smith"@here.ac.ca>) But the text between the " and the > is different in each address of course, so the text between would have to be taken out by a wildcard. Thanks for any ideas. I can't get my old retired brain around this.
John.Smith@here.ac.ca" John.Smith"@here.ac.ca>
I want to find and replace the first set of quotation marks and everything following up to and including the > ....(that is all of this " John.Smith"@here.ac.ca>) But the text between the " and the > is different in each address of course, so the text between would have to be taken out by a wildcard. Thanks for any ideas. I can't get my old retired brain around this.
John.Smith@here.ac.ca" John.Smith"@here.ac.ca>
Last edited by MrProgrammer on Sun Jan 07, 2024 1:09 am, edited 1 time in total.
Reason: Dropped: No attachment provided when requested -- MrProgrammer, forum moderator
Reason: Dropped: No attachment provided when requested -- MrProgrammer, forum moderator
OpenOffice 3.3.0 on Windows 7
Re: Search and replace this
If there is one email address per line then
with Regular Expressions selected in the More Options area, should do it.
Code: Select all
".+>
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Search and replace this
No that did not work. Perhaps I left out too much of the lines. Let me put the whole thing in even though the first mail to part seems ok to leave.
"mailto:John.Smith@here.gc.ca" <"mailto:John.Smith"@here.gc.ca>
now, when I try “.+> to take out the second part " <"mailto:John.Smith"@here.gc.ca> nothing is found. I have selected regular expressions and tried selecting all file and part of it etc. Otherwise find and replace works properly for single words or " >. Those are all found just fine.
I really appreciate someone who can figure this out.
So to be clear, I want all of this to go " <"mailto:John.Smith"@here.gc.ca> including the space after the first set of quotations
"mailto:John.Smith@here.gc.ca" <"mailto:John.Smith"@here.gc.ca>
now, when I try “.+> to take out the second part " <"mailto:John.Smith"@here.gc.ca> nothing is found. I have selected regular expressions and tried selecting all file and part of it etc. Otherwise find and replace works properly for single words or " >. Those are all found just fine.
I really appreciate someone who can figure this out.
So to be clear, I want all of this to go " <"mailto:John.Smith"@here.gc.ca> including the space after the first set of quotations
OpenOffice 3.3.0 on Windows 7
Re: Search and replace this
Please upload an ODF type sample file here without sensitive data, but with same structure as your original file.I really appreciate someone who can figure this out.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Search and replace this
Thank you. I was being clear as possible when I said that out of the entire line I wanted this to go " <"mailto:John.Smith"@here.gc.ca> that is the entire part which runs to the end of the line. Thanks if you can figure it out.
OpenOffice 3.3.0 on Windows 7
Re: Search and replace this
So, based on the examples I can make an educated guess:
Also, do you need to check for matched pairs (quotes and angle brackets) and/or null values in pre-existing entries so we only modify entries where the modification is relevant, or can we assume that source data is continuous and all well structured according to the above description?
- Outer <> delimiters should persist when present.
- The mail address within (or without) the <> needs adjustment as follows:
- everything before the @ should be quoted as one item,
- leading spaces if present
- "mailto:" link protocol specifier if present.
- recipient ID
- Mail domain specifier after the @ should be kept as is, only stripping quotes where present.
- everything before the @ should be quoted as one item,
Also, do you need to check for matched pairs (quotes and angle brackets) and/or null values in pre-existing entries so we only modify entries where the modification is relevant, or can we assume that source data is continuous and all well structured according to the above description?
Re: Search and replace this
I'm somehow baffled now.
There is one format used with the protocol specifier "mailto:!" I know which allows to additionally include a plain name in a specific position excluded from interpretation by a pair straight of doublequotes. Examples for valid email addresses using the "mailto:" are:
mailto:me@somedomain.tld
mailto:<me@somedomain.tld>
mailto:""<me@somedomain.tld>
mailto:"Lupp"<me@somedomain.tld>
I did not research and study specifying sources, but concluded from examples my Thunderbird accepts. If I enter an ordinary email address in Open-/Libre-Office it is recognised (URL recognition enabled) and the link in the background gets automatically prefixed the "mailto:".
Thus an applicable syntax in RegEx should be (a few minor aspects aside):
Please note that the RegEx will not reject entries with a malformed mailto:"??" part ( a missing doublequote e.g.) if then comes a correct match.
I'm interested in leraning from the OQ how I misinterpreted the question and from everybody how to simplify, improve, or aptly critisize the RegEx.
There is one format used with the protocol specifier "mailto:!" I know which allows to additionally include a plain name in a specific position excluded from interpretation by a pair straight of doublequotes. Examples for valid email addresses using the "mailto:" are:
mailto:me@somedomain.tld
mailto:<me@somedomain.tld>
mailto:""<me@somedomain.tld>
mailto:"Lupp"<me@somedomain.tld>
I did not research and study specifying sources, but concluded from examples my Thunderbird accepts. If I enter an ordinary email address in Open-/Libre-Office it is recognised (URL recognition enabled) and the link in the background gets automatically prefixed the "mailto:".
Thus an applicable syntax in RegEx should be (a few minor aspects aside):
Code: Select all
(^|\W)((mailto:)?[A-Z][A-Z0-9]+@[A-Z][A-Z0-9]{2,}\.[A-Z]{2,}(\W|$)|(mailto:"[^"]*"<)[A-Z][A-Z0-9]+@[A-Z][A-Z0-9]{2,}\.[A-Z]{2,}>)(\W|$)
Please note that the RegEx will not reject entries with a malformed mailto:"??" part ( a missing doublequote e.g.) if then comes a correct match.
I'm interested in leraning from the OQ how I misinterpreted the question and from everybody how to simplify, improve, or aptly critisize the RegEx.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Search and replace this
Please upload a sample file. I submitted a reply and deleted it because it was based on assumptions which may or may not be true. I will not make any more guesses without a sample to test.
AOO 4.1.14 on Ubuntu MATE 22.04
Re: Search and replace this
Thank you. No, what you have is the correct format to delete....that is the sample....that is why the John Smith is in there in place of the elected politicians which would make up this large mailing list when edited with search and replace.
But there is a vitriol in this forum. I don't want to get in the line of fire. Just say it can't be done and we will leave it at that.
Thanks.
But there is a vitriol in this forum. I don't want to get in the line of fire. Just say it can't be done and we will leave it at that.
Thanks.
OpenOffice 3.3.0 on Windows 7
Re: Search and replace this
A real ODF type file - uploaded it here: THAT IS the sample. The pictures, textual samples, and other attahments can give us SOME informations. But a real file give us ALL OF the available information about your/software issues......that is the sample...
Not needed to upload your original file with the original data. Change some data to "dummy" data, delete the sensitive data from a copy of your file, and then upload it here. The file size limit is 128 KiB in this Forum.
Last edited by Zizi64 on Wed Jun 20, 2018 10:15 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Search and replace this
Search for: [:space:].+ works for me in the sample document I created, but since I don't have a sample of your document to test, it may or may not work or might just completely destroy your document.Ciscokid2 wrote:Just say it can't be done and we will leave it at that.
AOO 4.1.14 on Ubuntu MATE 22.04