Mobileread
Search and Replace
#1  Ashjuk 01-09-2021, 05:35 AM
I am having a few issues with search and replace that I can't seem to find an answer to.

How do I make S&R case sensitive?

How do I make S&R find and replace whole words only?

I have done a number of S&Rs on a whole book and have found that it appears to not only replace words with the same case but those of the opposite case too - i.e. a search for color to replace with colour will also replace Color with colour.

Another issue I have come across is that if the search term I am looking for - as a whole word - is embedded in another word that appears to get changed too.

I have looked in preferences and can't seem to see anything that relates to this.
Reply 

#2  Tex2002ans 01-09-2021, 08:17 AM
Quote Ashjuk
How do I make S&R case sensitive?
After you press Ctrl+F, you should be able to change Mode to "Case Sensitive".

Quote Ashjuk
How do I make S&R find and replace whole words only?
If you change Mode to "Regex", you can use Regular Expressions.

In Regular Expressions, \b = a word boundary... so if you wanted to search for a whole word:

Search: \bcolor\b
Replace: colour

Note: Regular Expressions are already case sensitive, so that won't match "Color" or "Colors". And since it's whole words, it won't match "colorimeter" or "technicolor".

Alternate Method

Your best bet will probably be Sigil's fantastic Tools > Spellcheck > Spellcheck.

This allows you to search through all words in a book in an easy-to-read list.

In there, you're also able to select a word, then "Change Selected Word to":

show attachment »
Reply 

#3  Ashjuk 01-09-2021, 08:50 AM
Thanks Tex2002ans - that seems to be just what I was looking for.
Reply 

#4  Ashjuk 01-09-2021, 09:27 AM
I have tried the Spellcheck option as suggested by Tex2002ans and I get the following result -
https://www.mobileread.com/forums/at...1&d=1610198353

The language has defaulted to US English (the book was published in the US) so it is now picking up words that I have already corrected to UK spelling as being misspelled.
I have tried clicking on the Language column to see if I can change it to UK English so that it spellchecks against the default UK dictionary, but there appears to no way to do that.

What am I missing?
spellcheck.jpg 
Reply 

#5  BeckyEbook 01-09-2021, 09:47 AM
How is Sigil to know a word is in British and not American?
If the main language is set to US, individual phrases in British must be clearly marked:
Code
<span xml:lang="en-GB">colour</span>
Maybe it seems difficult, but if I have a whole book in Polish, and only a few dialogues in French, Italian or Spanish, it is obvious for me to mark the correct languages in these specific places. Then not only the spell check in Sigil works correctly, but also – what is equally important – appropriate readers can distinguish the language and for visually impaired people such expressions are read in correct languages by correct voices, and additionally words in foreign languages are hyphenated according to dictionaries assigned to these languages, not the main language in the e-book.
Reply 

#6  Ashjuk 01-09-2021, 10:16 AM
Sorry Becky, I'm not sure I understand you.

The book was written with US spellings and all I want to do is spellcheck it against the default UK dictionary.

The spellcheck pop-up has spotted that it's a US book -as the language column has been set to that - so it's telling me that UK spellings are wrong.

All it appears to be doing at the moment is highlight words that it considers are misspelt in American and NOT those that are misspelt in UK English because it's checking against a US dictionary - which I don't have set as my default.

Oh, and the language in the opf is - <dc:language>en</dc:language>
Reply 

#7  KevinH 01-09-2021, 11:30 AM
In Sigil Preferences: set your Primary Spellcheck dictionary to English-Great Britain.

Then try spellchecking again. If there are still issues, then look for lang or xml:lang attributes set to en-US someplace in the html.
Reply 

#8  Ashjuk 01-09-2021, 11:50 AM
Thanks Kevin,

My default dictionary was already set to English - Great Britain, but your second suggestion was the problem as the headers all had lang="en-US" xml:lang="en-US in them.

I have removed the -US from them and Spellcheck now works as it should and only picks up UK misspelled words.

I will remember to look for that in the future.
Reply 

#9  isaacbh 02-25-2021, 04:39 AM
Quote BeckyEbook
How is Sigil to know a word is in British and not American?
If the main language is set to US, individual phrases in British must be clearly marked:
Code
<span xml:lang="en-GB">colour</span>
Should I set both lang and xml:lang in a span? This is for epub 2.
Reply 

#10  BeckyEbook 02-25-2021, 05:47 AM
Although it does not make sense, entering both will not hurt, and may help the disabled. It is important to correctly declare the correct language. Why? Well, the disabled use various software to read the text. The software is different – one program recognizes "lang", the next "xml:lang", and another recognizes both.

So typing both IMHO is not a bad idea.

But I know that there are people here who have the opposite opinion.

http://kb.daisy.org/publishing/docs/html/lang.html
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register