View Single Post
Old 01-09-2015, 05:43 AM   #2
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by 1v4n0 View Post
If I put the regex between (brackets) it saves the value it finds, which then I can paste by writing \1 in the "replace" field.
That isn't "brackets" it is "parenthesis."

Quote:
Originally Posted by 1v4n0 View Post
EDIT: Issue had already been solved, here.
Also, great job with the edit. So often you see others say something along the lines of "found the answer," and they never post the solution! So when others stumble upon this topic, they have no clue!

If you are just starting out with Regex, I would recommend looking through the Sticky Regex topic here for lots of examples:

https://www.mobileread.com/forums/sho...d.php?t=167971

Anyway, this one is as easy as pie. What I would typically do is this:

Search: -([0-9])
Replace: - \1

May I ask exactly what the use case is for adding a space between a dash and a number?

The only thing I can think of with dashes and numbers is swapping hyphen -> en dash.... although maybe my mind is just too far up proper typography field.

For example, I use this one all the time:

Search: ([0-9])-([0-9])
Replace: \1–\2

So what this does is replaces "number" + "hyphen" + "number" with "number" + "en dash" + "number".

This is the typographically correct way when dealing with years, or page numbers:

1910–1930
pp. 320–325

Last edited by Tex2002ans; 01-09-2015 at 05:45 AM.
Tex2002ans is offline   Reply With Quote