
1 kyrre OP 目前搜到离答案最近的是 http://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word 但悲剧的是我自己用 grep '^((?!hede).)*$' b.txt 居然没用。 |
3 54c3 2017-03-02 18:38:16 +08:00 |
4 54c3 2017-03-02 18:39:54 +08:00 |
5 langmoe 2017-03-02 18:44:06 +08:00 http://regex.alf.nu/ 考验功力上这个啊 |
6 hellogbk 2017-03-02 19:21:17 +08:00 ^(?!.*hede.*).*$ |
7 ProkillerJ 2017-03-02 19:33:00 +08:00 5 楼那个网站已经把正则玩出花了,不怕虐的可以去试一下 |
8 DiamondbacK 2017-03-02 19:41:41 +08:00 Use `grep -P pattern`. |
9 wojiaodaxiaxia 2017-03-02 19:49:55 +08:00 6 楼应该是最准确直观的答案了吧 |
11 kinghs 2017-03-02 20:21:58 +08:00 via iPhone ^(?!.*hede).*$ |
12 ColinZeb 2017-03-02 21:41:48 +08:00 @langmoe afoot|catfoot|dogfoot|fanfoot|foody|foolery|foolish|fooster|footage|foothot|footle|footpad|footway|hotfoot|jawfoot|mafoo|nonfood|padfoot|prefool|sfoot|unfool |
14 pysama 2017-03-02 22:12:05 +08:00 /^(?!.*hede).*$/gi |
16 kyrre OP |
21 lianyue 2017-03-02 22:28:02 +08:00 js /(^|\n)((?:(?!hede).)+)(?=\n|$)/g ..其他的 支持 后断言 的 /(?<=^|\n)(?:(?!hede).)+(?=\n|$)/g |
23 mdzz 2017-03-02 23:29:54 +08:00 LZ 可能是想要一个 ABAB 叠字的正则 |
26 kyrre OP |
27 nicevar 2017-03-03 11:22:23 +08:00 正则功力几乎为 0 ,每次都是用的时候不断尝试,或者直接问同事 |
28 flfwzgl 2017-03-03 12:48:29 +08:00 `hoho hihi haha fahedewwf`.replace(/\n.*hede.*\n?/g, '\n') |