Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2026, 05:48 PM   #1
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 95
Karma: 10
Join Date: Jul 2023
Device: none
Is there a simple way to replace all spaces in file names with _ in the book browser?

The best I've come up with is to have the strings below in a text editor and then copy and paste them each time into regex rename.
(.*) (.*) (.*)
\1_\2_\3
(.*) (.*)
\1_\2
jwes is offline   Reply With Quote
Old 01-09-2026, 06:03 PM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,208
Karma: 6565382
Join Date: Nov 2009
Device: many
What generates the spaces into file names? I rarely if ever encounter spaces anymore in files names inside epubs.

Assuming this is a common problem, you can use a file base name and automagically number files in BookBrowser around that base which I commonly use for Chapters leaving only front matter and end matter to hand edit the names for but that changes the root name of the file.

Using Regex Rename is probably the easiest way to preserve parts of existing file names.

Have you tried using (\s) at the Regular Expression and _ as the Replacement?

Seems to work for me.
Attached Thumbnails
Click image for larger version

Name:	regex_rename.png
Views:	17
Size:	44.5 KB
ID:	220175   Click image for larger version

Name:	result.png
Views:	12
Size:	61.9 KB
ID:	220176  

Last edited by KevinH; 01-09-2026 at 06:17 PM.
KevinH is offline   Reply With Quote
Old 01-09-2026, 06:28 PM   #3
jugaor
Enthusiast
jugaor began at the beginning.
 
jugaor's Avatar
 
Posts: 39
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
Indeed.
But you don't need to capture the search.
And better with “+”, just in case:

Code:
\s+
_
jugaor is offline   Reply With Quote
Old 01-09-2026, 07:19 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,208
Karma: 6565382
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by jugaor View Post
Indeed.
But you don't need to capture the search.
And better with “+”, just in case:

Code:
\s+
_
Yes, that is simpler and better.
KevinH is offline   Reply With Quote
Old 01-10-2026, 02:55 AM   #5
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 95
Karma: 10
Join Date: Jul 2023
Device: none
Quote:
Originally Posted by jugaor View Post
Indeed.
But you don't need to capture the search.
And better with “+”, just in case:

Code:
\s+
_
Thank you. I looked at the example in the manual and made the wrong assumption that I needed to recreate the entire new file name. This might be another good example if someone wants to add it to the manual.
jwes is offline   Reply With Quote
Old 01-10-2026, 03:27 AM   #6
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 95
Karma: 10
Join Date: Jul 2023
Device: none
Quote:
Originally Posted by jwes View Post
Thank you. I looked at the example in the manual and made the wrong assumption that I needed to recreate the entire new file name. This might be another good example if someone wants to add it to the manual.
Here are some pictures that could be used.
Attached Thumbnails
Click image for larger version

Name:	regex1.png
Views:	20
Size:	38.2 KB
ID:	220188   Click image for larger version

Name:	regex2.png
Views:	21
Size:	50.7 KB
ID:	220189  

Last edited by jwes; 01-10-2026 at 03:29 AM. Reason: pictures didn't show
jwes is offline   Reply With Quote
Old 01-10-2026, 10:42 AM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,208
Karma: 6565382
Join Date: Nov 2009
Device: many
You probably do not want single or double quotes inside a file name either. Starting a file name with a real alpha character instead of punctuation or a digit is also highly recommended.

So you should expand that regex to handle those replacements as well.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex expression to replace certain spaces with nonbreaking spaces Dashcroft Sigil 3 12-10-2022 09:01 PM
Converted book file names 7cats Conversion 7 03-02-2018 03:32 AM
Check book 'omits' message about large file (File browser) chaot Editor 1 06-02-2016 02:33 PM
How can I remove spaces from folder and file names? jusmee Calibre 1 11-06-2009 11:36 PM
Mobi2mobi -spaces in file names jflatto Kindle Formats 4 09-26-2008 12:38 AM


All times are GMT -4. The time now is 07:24 PM.


MobileRead.com is a privately owned, operated and funded community.