[Solved] Replacing a letter inside a word

Discuss the word processor

[Solved] Replacing a letter inside a word

Postby clausisme » Mon Jan 22, 2018 3:30 pm

Some time ago there was a grammatical change in the way some words are written in romanian. Here is one of these rules:
- when inside a word î turns into â like: cît > cât. But only when inside a word, this does not apply when it's at the beginning or at the end of the word like this: încît > încât.

I have some old books and I need to use a replace command in writer.
Last edited by clausisme on Tue Jan 23, 2018 9:29 am, edited 2 times in total.
OpenOffice 4.01 on Windows 7
clausisme
 
Posts: 14
Joined: Fri Mar 28, 2014 3:23 pm

Re: Replacing a letter inside a word

Postby acknak » Mon Jan 22, 2018 5:19 pm

This works for me with your example:

Edit > Find & Replace
Search for: (?<=\w)î(?=\w)
Replace with: â
Options/Regular expressions: ON

Click Replace All

The patterns around the î are "lookbehind" and "lookahead" elements that require a "word" character, \w, before and after the letter, but they don't include the word characters in the actual match, so they are not replaced.

These pattern elements are explained here (for example):
https://www.regular-expressions.info/lookaround.html
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Replacing a letter inside a word

Postby clausisme » Tue Jan 23, 2018 9:26 am

Thank you. That worked.
OpenOffice 4.01 on Windows 7
clausisme
 
Posts: 14
Joined: Fri Mar 28, 2014 3:23 pm


Return to Writer

Who is online

Users browsing this forum: RPG and 35 guests