I'm hoping there's a hard core regex search user on the forum who can point me in the right direction.
I'm trying to take a OOWriter doc which is a dictionary and convert it to a .csv delimited file. The file has the following format. The first word or words of each paragraph which is the term being defined in the dictionary and is in bold, then the definition follows in normal (non-bold) text.
I want to insert a delimiter character between the term and the definition.
What I need is a regex which will find the first non-bold word or character in a paragraph so I can insert a delimiter character just before it. Is that doable?
Thanks for any replies.
I've spent a great deal of time searching and reading. I think I'm on the right trail but I'm not getting it on my own. If anyone could steer me in the right direction it would be greatly appreciated!
Greg
[Solved] Find the first non-bold char in a paragraph
[Solved] Find the first non-bold char in a paragraph
Last edited by Hagar Delest on Wed Aug 10, 2011 8:19 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice 3.3.0 on Mac OS X 10.7
- Hagar Delest
- Moderator
- Posts: 32664
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: Regex search - find the first non-bold char in a paragra
Hi and welcome to the forum!
What seems to work (note that I add the coma after the bold word instead of before the first non bold word but I guess it's the same for the export):
- Search for: .* (in More options: Format -> bold)
- Replace with: &,
In the More options, check Regular expressions.
Then Find All and Replace all. Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
What seems to work (note that I add the coma after the bold word instead of before the first non bold word but I guess it's the same for the export):
- Search for: .* (in More options: Format -> bold)
- Replace with: &,
In the More options, check Regular expressions.
Then Find All and Replace all. Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Re: Regex search - find the first non-bold char in a paragra
Wow that's really doing something different for me. Searching for .* is highlighting the whole paragraph and if I do a replace it's bolding the whole thing! Very different behavior from what you got. What am I doing wrong?Hagar de l'Est wrote:Hi and welcome to the forum!
What seems to work (note that I add the coma after the bold word instead of before the first non bold word but I guess it's the same for the export):
- Search for: .* (in More options: Format -> bold)
- Replace with: &,
In the More options, check Regular expressions.
Then Find All and Replace all. Please add '[Solved]' at the beginning of your first post title (edit button) if your issue has been fixed.
Greg
OpenOffice 3.3.0 on Mac OS X 10.7
Re: Regex search - find the first non-bold char in a paragra
Hi,
May be you forgot this step :
May be you forgot this step :
(in More options: Format -> bold)
LibreOffice 6.4.5 on Windows 10
Re: Regex search - find the first non-bold char in a paragra
Doh! Thanks! That works almost as needed. We're getting close but there's a problem, and that is in the description there also are words that are also in bold. The regex you suggested is finding them too. That's why the regex has to match only the bold at the start of the paragraph. Is there any way to do that?gerard24 wrote:Hi,
May be you forgot this step :(in More options: Format -> bold)
Thanks!
Greg
OpenOffice 3.3.0 on Mac OS X 10.7
Re: Regex search - find the first non-bold char in a paragra
It looks like changing the input string from .* to ^.* did the trick.takoateli wrote:Doh! Thanks! That works almost as needed. We're getting close but there's a problem, and that is in the description there also are words that are also in bold. The regex you suggested is finding them too. That's why the regex has to match only the bold at the start of the paragraph. Is there any way to do that?gerard24 wrote:Hi,
May be you forgot this step :(in More options: Format -> bold)
Thanks!
Greg
Thanks for getting me started!
Greg
OpenOffice 3.3.0 on Mac OS X 10.7