RegEx - how to replace a carriage return
Posted: Tue May 01, 2018 9:28 pm
Hallo
I am trying to replace with a Regular Expression some numbers with carriage return (also called paragraph breaks) to nothing but it aint working.
This is examplarily my text:
I could easily find and replace with nothing the numbers, no problem, but then I have left some empty lines.
In normal RegEx I would go for the hex value, e.g.:
Search with Regex:
and combine it with the numbers, e.g.
but this (\x0A) doesnt find the carriage returns on my Mac OS 10.11.6 with OO 4.1.5
So neither are working \n nor \x00A nor \x000A nor \x0D\x0A - I tried a lot.
I found in some post the $ (which is in normal RegEx just the line end, without any length!) but this is not helping, because I can not eliminate the carriage return, I can just find a line's end.
So how can I find and replace the real carriage return character with regex on Mac OS 10.11.6 and OO 4.1.5?
The digits I easily can find, but only not the carriage return.
The line break (with Space+Retrurn) I can find with \n
Thanks.
frank
PS.: I asked that in a german openoffice forum before and got there the hint to ask here.
I am trying to replace with a Regular Expression some numbers with carriage return (also called paragraph breaks) to nothing but it aint working.
This is examplarily my text:
where I want to eliminate the numbers (these were page numbers, hardcoded ones) but also the carriage returns (such ones done with Return without Space).Blabla
1
blabla
blablablabla
2
blabla blabla
12
blabla
13
basdaf
asdfasd
14
asdfa
I could easily find and replace with nothing the numbers, no problem, but then I have left some empty lines.
In normal RegEx I would go for the hex value, e.g.:
Search with Regex:
Code: Select all
\x0A
Code: Select all
\x0A\d{1,2}
So neither are working \n nor \x00A nor \x000A nor \x0D\x0A - I tried a lot.
I found in some post the $ (which is in normal RegEx just the line end, without any length!) but this is not helping, because I can not eliminate the carriage return, I can just find a line's end.
So how can I find and replace the real carriage return character with regex on Mac OS 10.11.6 and OO 4.1.5?
The digits I easily can find, but only not the carriage return.
The line break (with Space+Retrurn) I can find with \n
Thanks.
frank
PS.: I asked that in a german openoffice forum before and got there the hint to ask here.