正如标题所示,我需要在文本文档中每行的开头和结尾添加空格字符。
以下是文字的摘录:
56
00:04:28.620 --> 00:04:32.070
and a little sturdier sounding, but it
also alters the articulation of it.
57
00:04:32.070 --> 00:04:35.310
So that's what's kind of cool about
parallel compression, you kind of beat
58
00:04:35.310 --> 00:04:39.790
something up a little bit and blend it in,
and you get the best of both worlds.
我正在使用Brackets(OSX)并且希望有人可以帮我找到一个可以在find& amp;中使用的正则表达式。替换功能,但当然,欢迎任何更好的建议!
原因: 我正在准备这个大型的成绩单(+100000行)进行文本分析,需要在进入MATLAB的分析仪之前进行准备。
答案 0 :(得分:0)
通过外观,您可以搜索这些位置:
^(?=\S)|(?<=\S)$
这些职位需要由\
替换,请参阅a demo on regex101.com。
^(?=\S) # ^ = start of line (multiline mode)
# plus making sure there's no whitespace immediately ahead
| # or
(?<=\S)$ # pos. lookbehind and end of string/line