Search
Other ReReplacer questions
Forum

Replacing space with non-breaking space

marvays's Avatar marvays
Hello.
I use the Czech language. In our language, there are many strict conditions on how to write correctly in Czech. I was originally trained as a printer and I pay a lot of attention to grammar and graphics and I want to get everything right.
I am solving a problem with texts on the Internet. Specifically, line wrapping. It happens that a new line appears in the text where it shouldn't.
Is it possible to set ReReplacer to watch the text and in certain cases replace the space between words with a non-breaking space?

For example, the English "with" is pronounced "s" here.
Consider the sentence:
I saw a locomotive with ten wagons.

In the Czech language it is written:
Viděl jsem lokomotivu s deseti vagóny.

In the text, there can be a siruation when I see the text"
Viděl jsem lokomotivu s
deseti vagóny.
But that can't be right. Therefore, I would need ReReplacer to replace the classic space with the indivisible one every time it sees a separate song "with" after it.

The result will then be grammatically correct:
Viděl jsem lokomotivu
s deseti vagóny.

And there will be more such fonts... "s", "S", "a", "A", "z", "Z" (with, and, from) and more.

As I wrote, I'm not a programmer, but a graphic artist, and I need help with this 🙁

Thx

PS: Consider creating a database of useful commands used by ReReplacer. People might like it.
Peter van Westen's Avatar Peter van Westen ADMIN
You can do this with Regular Expressions:
[[space]](s|a|Z)[[space]]
(there is a
Replace with:
 $1[[space]]

Alternatively you make the search case sensitive in case you want to add things that you for instance only want replaced if it is in that casing. Then the above search would be:
[[space]](s|S|a|A|z|Z)[[space]]

As described in the Dynamic Tags section, use [[space]] instead of leading and trailing spaces (otherwise they will get stripped upon saving).
Please post a rating at the Joomla! Extensions Directory
marvays's Avatar marvays
And this will only replace the space for me? Or even before?

I need this:
"space"s"space"
->
"space"s" "
Peter van Westen's Avatar Peter van Westen ADMIN
So:
([[space]](s|a|Z))[[space]]
Replace with:
$1 

Or:
[[space]](s|a|Z)[[space]]
Replace with:
[[space]]$1 

(both should result in the same)
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription