I would like to change all
##,
to
*##,
where # is a digit, an * just a symbol (it could be something else).
Can I do this in 1 search and replace all using regular expressions?
[Solved] Regular expression in search
[Solved] Regular expression in search
Last edited by Hagar Delest on Mon Jul 23, 2018 10:17 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OO 4.1.6 in 64 bit Windows 10
Re: regular expression in search
AltSearch from the extensions repository should do this for you.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Regular expression in search
Why did you post this in the 'Macros' branch?
In a RegEx a single digit is represented by "[0-9]", two subsequent digits by "[0-9]{2}" To make the finding available in the ReplaceWith you can use the RegEx "([0-9]{2})" and reference the found string by "$1". I use 'Prefix' now for what you represented by an asterisk.
Search for : ([0-9]{2})
Replace with: Prefix$1
With Prefix = § applied with 'Replace All' to foo1978bar this would result in foo§19§78bar.
If this is not what you want, please explain your intentions more precisely.
In a RegEx a single digit is represented by "[0-9]", two subsequent digits by "[0-9]{2}" To make the finding available in the ReplaceWith you can use the RegEx "([0-9]{2})" and reference the found string by "$1". I use 'Prefix' now for what you represented by an asterisk.
Search for : ([0-9]{2})
Replace with: Prefix$1
With Prefix = § applied with 'Replace All' to foo1978bar this would result in foo§19§78bar.
If this is not what you want, please explain your intentions more precisely.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Regular expression in search
See [Tutorial] How to record a macro (and Regular Expressions)
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Regular expression in search
Lupp from Munchen, I posted here because the issue was part of a macro, and I thought tjat I'd need additional help. However your help solved the problem. Thanks
Eustace from New York
Eustace from New York
OO 4.1.6 in 64 bit Windows 10