I have a string like this:

```
#a
b

#c
d

```

I would like to break it up into sections beginning with `#`:

```
#a
b

```

and

```
#c
d

```

I have attempted this with a regular expression, but I find that I can’t get it working.

I though that the following would work:

```
var test='#a\nb\n#c\nd';
var re=/#.*?/gs;
var match=test.match(re);
alert(match.length);
alert(match);

```

That is, the `s` modifier matches through line breaks, and the `g` modifier picks up multiple instances. The `?` lazy quantifier should stop the `*` from going too far.

However, I find that when I use just `s`, it only goes to the end of the line.

Clearly there’s something I’m not getting about either the regular expression or the `match()` method.

By the way, I know that `s` is only a recent addition to JavaScript, but I’m working in Electron, where it is readily available.