Question: I have two datagrids with same properties defined in code behind.

```
var dtg = new DataGrid();

```

then I assign an event though lambda expression (quite a long one):

```
dtg.LoadingRow += (object sender, DataGridRowEventArgs e) =>
{
    ...
};

```

which I do not want to replicate.
So how can I do that (pseudocode):

```
var dtg2 = new DataGrid();
dtg2.LoadingRow = dtg.LoadingRow;

```

thanx

Answer: 
First - just as an explanation - your regex *defines* a character class (`[` ... `]`) that matches any of the characters `1`, `?`, `|` or `0` one or more times (`+`). I think you mean to have `(` ... `)` in it, among other things, which would make the `|` an alternation lazy matching a `0` or a `1`. But that's not either what you want (I think ;).

Now, the solution might be this:

```
([01])\1*

```

which matches a `0` or a `1`, and captures it. Then it matches any number of the same digit (`\1` is a back reference to what ever is captured in the first capture group - in this case the `0` or the `1`) any number of times.

[Check it out at ideone](http://ideone.com/FXpQx3).
You can try this:

```
(1+|0+)

```

[Explanation](https://regex101.com/r/RHIu0r/9)

Sample Code:

```
    final String regex = "(1+|0+)";
    final String string = "10000111000011\n"
            + "11001111110011";

    final Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);
    final Matcher matcher = pattern.matcher(string);

    while (matcher.find()) {

                System.out.println("Group " + 1 + ": " + matcher.group(1));

    }

```