how do I search for cells with single char only and not all cells containing that char?
eg, I want to find and replace all cells with only the character b, and not all the cells that contain a b anywhere in it.
With F&R (Ctrl+H) use regular expressions (âRegExâ)
Example:
^c$
will find cells containing the character âcâ and nothing else. If âCâ (upper case) also is found depends on the setting for âmatch caseâ. There are many additional ways to.control the working of RegEx. In the given example ^
means âfrom startâ and $
means âtill endâ. The c
represents a single occurrence of the literal.
A very good tutorial about RegEx is Regular Expression Tutorial - Learn How to Use Regular Expressions.
Thanks for responding.
I am not familiar with RegEx.
However, I tried to simply use the find function (ctrl - H) using ^b$ as the argument and I got the same result as just using a simple b. It returned every cell containing anything with a b.
In this case, itâs possible to achieve without regex.
Search for c
Mark the option âEntire cellsâ
This is not the expected behavior.
Thank you Mariosv. That was the simple answer I was seeking.
Answers by @Mariosv are always valuable.
Nonetheless:
- The subject of your question used the more general term refinement, and only the content of the question specialized this. If any visitor to this thread (yourself probably) one day is looking for a slightly different kind of refinement, they will need to use RegEx.
- If the solution I suggested didnât work for you, the reason probably was that you missed to enable the option Regular expression under âOther optionsâ.
- As an example you may look for cells containing a âbâ preceded by nothing and followed by either a single âcâ or nothing. The simple RegEx
^bc?$
can do that. A specialized option for every case of the kind canât exist. - Very few users are familiar with RegEx on a high level. However, many can use the most frequently needed means they provide efficiently. The advanced support for RegEx is one of the relevant advantages of LibreOffice over MS software.