Searching for a text with AND without Regular Expressions

I’m trying to replace all " ..." with "..."
In other words remove the space before three dots.

I search for [:space:]... but then “...” is a regular expression as well (very strange considering how commonly it’s used).

So I’m stuck with a search where I want the regular expression on for one character and off for the rest. There must be a solution for this but half an hour of searches didn’t reveal anything. Do you have an idea? Thanks.
edit by @karolus escape the three dots from crazy software-assumptions

OK. I managed to catch my three periods (no, I consciously do not use ellipsis).
Using slash.slash.slash. with a space or the [:space:] I search and find my " …"s but now when I type just three dots or slash.slash.slash. in the replace box, instead of replacing them, it ADDS them. Wtf!
Now I have all those six periods! What’s going on?
(Thank you all for taking the time.)
(Apparently this site removes the slashes and turns six periods into three periods.)

You also could find (\.\.\.) (say: space, parentheses, three backslash-point series and parentheses), and replace with $1. With regular expressions.

1 Like

You have two solutions:

  • without regexp

    Enter “ ...”, i.e. space-dot-dot-dot in the Find box

  • with regexp

    The correct regexp is “ \.\.\.”, i.e. space followed by three occurrences of escaped dot, where \ is the escape character. No real need for [:space:] as it only represents a space but no other white space character.

Note also that is is typographically incorrect to type 3 dots in a row for an ellipsis. With three dots, line wrapping may occur inside the sequence which is supposed to be atomic. Instead use U+2026 HORIZONTAL ELLIPSIS. In many keyboard layouts, this character can be accessed with Alt and eventually Shift on a key.

There is nothing strange about the dot meta-character. Regexp originate in technical use of computers, notably programming, where the dot is seldom used per se. Then it has been set as a wildcard for any character. Regexp have been since offered in document processors where, effectively, the dot is rather frequent. Regexp have not been amended for that because of the necessary compatibility with existing utilities. You’ll have to live with it.

2 Likes

@ajlittoz there are no three dots, there is one character with unicode u2026

@karolus Vocabulary! Vocabulary! I trusted @icouldiwill’s wording and didn’t check the effective character. The atomic group of three dots is named ellipsis.

But anyway, my remark may be useful to somebody else.

I note that if you type three periods into this site, it renders as an ellipsis - the following was entered as three periods …

1 Like

Thanks. This is about text editing and for various reasons I use three periods instead of an ellipsis. Kudos for explaining. The issue is not resolved though. Check out main comments.

Perhaps your searching didn’t include the LibreOffice Help page for regular expressions.

That will tell you that the period rnatches any single character except a line break or a paragraph break. For example, the search term “sh.rt” matches both “shirt” and “short”.

And the backslash; the special character that follows it is interpreted as a normal character and not as a regular expression meta character (except for the combinations “\n”, “\t”, “\b”, “>” and “<”). For example, “tree.” matches “tree.”, not “treed” or “trees”.

So what you want is [:space:]... Note that if your ‘three dots’ are actually an ellipsis, you can simply use [:space:] followed by the ellipsis character without escaping it with backslash. In fact, you could simply use a space character followed by an ellipsis without the need for regular expressions.

Edit: dammit, this site has changed my reply. It should read
[:space:]\.\.\.

1 Like

Of course LibreOffice Help is always the first place I look but I failed to locate the /. notation among all the regex. Still the issue is not solved.

Simply search for: (spacebar)… and replace with
!NO REGEX! its unicode-point u2026 nothing else

Obviously this is exactly what didn’t work in the first place.

I just looking into the original post, and it seems this crazy software here does replace ... (three dots) by (epsilon) so youre right by accident @ajlittoz :wink:

If you do want an ellipsis in Writer instead of three dots and are using English you can turn on automatic replacement (crazy software assumptions?) of three dots by ellipsis in Tools > Options > Language Settings > English Sentence Checking and ticking the box labelled Ellipsis.
Maybe after completing Find " ..." (dots) and Replace "…" (ellipsis).

@EarnestAl: I dont talk about LO-software I talk about ask.libreoffice.org -site-software, which has replaced ... by in initial Question here