小编Mik*_*ike的帖子

Notepad ++ Regex替换 - \1不起作用?

只是为了序言,我已经阅读了许多关于此的问题,但我找不到答案(至少在我的挖掘中).如果我错过了,请随意指出!

我知道如何使用正则表达式,事实上我找到了我正在搜索的文本.但是,当我尝试做其他问题建议"\1MyAppendedTextHere"和替换时,它只是擦除匹配的模式并添加后面的内容\1.(之前提出的问题表明,"\1"记事本++是如何做到这一点的).这改变了吗?难道我做错了什么?

这是它的样子:

find: name[A-Z_0-9]+
replace: \1_SUFFIX
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏!

regex replace notepad++

13
推荐指数
1
解决办法
1万
查看次数

使用 jest 的 test.each 与使用 forEach 循环

有没有理由我更喜欢一种方法而不是另一种方法?这里有些例子:

describe('some tests', () => {
  [1, 2, 3].forEach(num => {
    test(`${num}: test`, () => {
      doSomeTestStuff(num)
    }) 
  })

  // vs.

  test.each([1, 2, 3])('%s: test', (num) => {
    doSomeTestStuff(num)
  })
})
Run Code Online (Sandbox Code Playgroud)

阅读test.each语法似乎有点困难,尤其是当您可以只执行本机 javascript 迭代来实现似乎相同的效果时。拆卸/设置仍然以相同的方式发生(据我所知)。

javascript jestjs

7
推荐指数
2
解决办法
724
查看次数

使用Bootstrap列折叠空格

首先,这是我正在讨论的问题的屏幕截图:

我试图让空白消失.例如,我希望第4条评论("评论评论评论")在第一条评论之下,它们之间没有很大的差距,而不是跳过该列并进入第二列.

基本上,我想要这些Bootstrap井的3列,而不关心其他列的注释的高度.我已经尝试过使用clearfix,但是我并不完全理解在这种情况下是否正确(无论如何我都无法工作).

这是代码:

<div class="container">  
  <div class="row comment-container">
    <div class="col-sm-4" ng-repeat="comment in comments">              
      <div class="well">
        <span><button type="button" class="close" ng-click="deleteComment(comment)" ng-show="isAdmin()">&times;</button></span>
        {{comment.text}}
        <br>
        <br>
        <p class='text-right'>-{{comment.name}}</p>
      </div>
    </div>
  </div>
  <div class="row">
      <form class="comment-form col-sm-8">
        <label>Leave your comment here!</label>
        <p class="form-group">
          <input type="text" class="comment-input form-control" placeholder="Your name" ng-model="newComment.name" ng-hide="isLoggedIn()">
          <input type="text" class="comment-input form-control" placeholder="Your comment" ng-model="newComment.text">
          <button type="submit" class="btn btn-primary comment-button" ng-click="addComment()">Comment</button>
        </p>
      </form>
  </div>


</div>
Run Code Online (Sandbox Code Playgroud)

这是我希望它看起来像的截图(这个例子说明了没有计算注释的高度并在一个修改版本的crazymatt代码上使用简单的%3比较的问题.

http://i7.minus.com/j6idHIfytxl1w.PNG

生成时间为:

<div class="comment-container">
      <div class="col-md-4">            
        <div class="well" ng-repeat="comment in comments" ng-if="($index) % 3 …
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap angularjs

5
推荐指数
1
解决办法
3027
查看次数

管道通信中的C问题

我正在尝试编写一些代码,这些代码使用管道在父进程和它的子进程之间进行通信.但是,我的管道在我第一次使用它之后似乎放弃了(也就是说,它在第一次使用管道后停止工作).我不确定如何解决这个问题,任何帮助将不胜感激.我也知道我在这里使用的一些编码实践并不是很理想(主要是使用睡眠).

const int READ = 0;
const int WRITE = 1;
char* COOP = "Criminal cooperates\n";
char* SIL = "Criminal doesn't talk\n";

char* reader(int);
void writer(int, char *c);

int main()
{       
    int c1pipe1[2];
    int c1pipe2[2];
    int c2pipe1[2];
    int c2pipe2[2];
    int c1sentence = 0;
    int c2sentence = 0;
    int r;
    int c;
    pipe(c1pipe1);
    pipe(c1pipe2);
    pipe(c2pipe1);
    pipe(c2pipe2);
    int C2;
    int C1 = fork();
    if(C1 > 0)
        C2 = fork();
    if(C1 < 0 || C2 < 0) //error
    {
        perror("fork() failed");
        exit(1);
    } …
Run Code Online (Sandbox Code Playgroud)

c linux pipe

2
推荐指数
1
解决办法
6767
查看次数

标签 统计

angularjs ×1

c ×1

css ×1

html ×1

javascript ×1

jestjs ×1

linux ×1

notepad++ ×1

pipe ×1

regex ×1

replace ×1

twitter-bootstrap ×1