incubator-ooo-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johnny Rosenberg <gurus.knu...@gmail.com>
Subject Re: Is there a way to do this...
Date Thu, 24 May 2012 21:21:04 GMT
2012/5/24 Johnny Rosenberg <gurus.knugum@gmail.com>:
> 2012/5/24 Ima Afrotrap <afrotrap@gmail.com>:
>> On Thursday, 24 May 2012 10:55 Johnny Rosenberg wrote:
>>> 2012/5/24 Ima Afrotrap <afrotrap@gmail.com>:
>>> > I often copy and paste from e-book formats into odt simply because odt is
>>> > always such a nice smaller file size and I have all the control in the
>>> > world over what kind of font I want to use, etc.
>>> >
>>> > One problem I often have is something like this...
>>> >
>>> > For instance, in the following sentence:
>>> >
>>> > -----
>>> > He had just said wearily,"There's no timber down there to build cabins."
>>> > -----
>>> >
>>> > There's no 'space' between the apostrophe and the beginning quotation
>>> > marks.
>>>
>>> When you say ”apostrophe”, do you actually mean ”comma”? Because I
>>> can't see an apostrophe directly followed by a quotation mark in that
>>> example sentence.
>>>
>>
>>  Oops! Sorry, yes, I meant comma.
>>
>>
>>> > In
>>> > this particular e-book, there is a *LOT* of this and I'll not be able to
>>> > enjoy reading the book if I have to stop every 5 seconds to click on the
>>> > spot and hit the spacebar all the time.
>>> >
>>> > I looked at the find/replace, but when I tried that it didn't work very
>>> > well and then I had to *delete* a space when it put it *between an
>>> > apostrophe and an end quotation mark.
>>> >
>>> > I don't understand well enough how to use the regular expressions and
>>> > would really like to be able to use the find/replace so it can do the
>>> > 1000+ corrrections for me and I can get back to the occassional manual
>>> > fix, heh.
>>> >
>>> > Does anyone have any idea how I can do this to make it easier on myself
>>> > and get ahead with actual reading? (hopefully I described the problem
>>> > well enough for someone to actually be able to help me).
>>> >
>>> >
>>> >  JB
>>>
>>> I tried your example with and without regular expressions and it
>>> worked easily in both cases. Can you give another example that
>>> contains every case where you need to add a space AND every case where
>>> you don't want an extra space?
>>> If the end quotation mark is the same character as the beginning
>>> quotation mark, then it will be very difficult to create a regular
>>> expression that is able to know which one is which. If there always is
>>> a space, period or a comma after the end quotation mark, I can see a
>>> way, though. I need to know the exact rules to create something that
>>> actually works in every situation that is likely to show up.
>>>
>>>
>>> Kind regards
>>>
>>> Johnny Rosenberg
>>
>> Here are some more cut and pasted straight from the e-book examples (note also
>> not just the comma, but it happens with a period):
>>
>> -----
>> said Jonnie."Don't you follow
>>
>> “You can have my other four horses,”
>
> I find it odd to have a comma inside a quote, but that's maybe another story.
>
>> said Jonnie to Chrissie."Don't eat them;
>> they're trained.” He paused."Unless you get awful hungry, of course, like in the
>> winter.”
>>
>> "I’ve been investigating a suspicion of conspiracy to sabotage transport,” said
>> Terl."Kept me busy for the last three weeks.”
>> -----
>>
>> I hope I'm showing everything necessary to see the problem better. If you want
>> even more examples, just holler and I'll cut and paste  a page if it's not too
>> big.
>>
>>
>>  JB
>
> I noticed that sometimes “ and ” is used, and sometimes there is just
> a ". Is this what happens or did something just happen when copying
> the text to your post?
>
> I did some experimenting and found that the tricky part (for me who is
> not that experienced with regular expressions) is that some lines
> start with a quotation mark, either " or “.
>
> Let me know if there really is a mix of ", “ and ” in the real text.
>
>
> Kind regards
>
> Johnny Rosenberg
> ジョニー・ローゼンバーグ

In your example, this seems to work:
☒ Regular expressions

Search for: (.|,|:|;)("|“)([:alnum:])
Replace with: $1 $2$3

Things inside parentheses are ”memorised”, so the string found in the
first parenthesis can be called with $1 in the Replace with field and
so on.

So first I search for one of . , : ; followed by either a " or a “
(not a ”) followed by an alphanumeric character (a-z, A-Z, 0-9).
For example ."D is found. It will be replaced by the result of the
first pair of parentheses followed by a space followed by the two last
pair of parentheses, in this case . "D.

Try it out and see if it works for you. You can always use the undo
button to undo a ”Replace All”, for example.
If it doesn't work in all cases, maybe you can try to modify it or
write back and tell us (or at least me…) what went wrong. I am sure
there is some cases that I didn't think of…


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Mime
View raw message