I have some text containing . A....
The regex is [.][\s][\s][!A-Z]
This finds the containing string. The problem is, that I don't know how to replace all of it with \n
except the [A-Z]
Asked
Active
Viewed 6,196 times
3

ctwheels
- 21,901
- 9
- 42
- 77

user3776738
- 214
- 2
- 10
- 27
-
Just as a side-note `[]` is not necessary around `\s`. Also, `[.]` can be rewritten as `\.`. So `\.\s\s[!A-Z]` is the same as your original regex (but shorter). Also, instead of declaring `\s\s`, use `\s{2}`. It uses 1 less step (at the expense of 1 extra character). Also, you can use grundic's solution or `\.\s{2}(?=[!A-Z])` and simply replace with `\n`. This option doesn't store a grouping into memory, but rather the position (it should perform slightly faster) – ctwheels Nov 01 '17 at 13:09