Android Question Regexreplace linefeed problem

rosippc64a

Active Member
Licensed User
Longtime User
I have a text and I would like to remove linefeeds if this is between two words.
The code is simple:
B4X:
    res = RegexReplace("([a-z|ő|ú|ö|ü|ó|é|á|ű|í]])\s*[\n|\r\n]\s*([a-z|ő|ú|ö|ü|ó|é|á|ű|í])", res, "\1 \2")
This regex expression works on B4J - Regex Example with Web Socket (and here too: https://regex101.com/), with this text:
Már egy évtizeddel a természetes radioaktivitás
felfedezése után, 1906-ban, Ernest Rutherford rámutatott arra,
hogy például a kőzetekben lévő radioaktív atommagok bomlása felhasználható
a kőzetek kialakulása óta eltelt idő, a földtani kor meghatározására.
...
.
All lines start some space (can't see here).
But same expression doesn't work if I use in regexreplace. I tried $1 instead of \1 also, \040 instead of \s, but no difference.
What is my fault?
 
Last edited:

rosippc64a

Active Member
Licensed User
Longtime User
Solved
res = RegexReplace("([a-z|ő|ú|ö|ü|ó|é|á|ű|í])\s*[\n|\r\n]\s*([a-z|ő|ú|ö|ü|ó|é|á|ű|í])", res, "$1 $2")
 
Upvote 0
Top