Question: I want my RegEx to work both on server and client side (with javascript)
I'm decorating my ViewModels like this:

```
    [Display(Name = ConstantKeys.ValidationMessage_Gender_Name)]
    [Required(ErrorMessage = ConstantKeys.ValidationMessage_Gender_Required)]
    [RegularExpression(RegExKeys.Gender, ErrorMessage = ConstantKeys.ValidationMessage_Gender_RegEx)]

```

But I don't know if it's possible to use RegexOptions.IgnoreCase for the RegularExpression attribute...

How can I write a regular expression that matches these:

```
word1|wORD2|wOrD3 ...

```

(I want the regular expression to still be human readable)
Thanks in advance.

**CLARIFICATION**:
I want to match ANY words (not just word1-3)
better example:

```
Man1|woMAN2|MoNkEY3

```

Answer: 
You want to set the [Rigidbody.constraints](http://docs.unity3d.com/ScriptReference/Rigidbody-constraints.html) to a [`RigidbodyConstraint`](http://docs.unity3d.com/ScriptReference/RigidbodyConstraints.html):

```
transform.rigidbody.constraints = RigidbodyConstraints.FreezePositionZ;

```

The `RigidbodyConstraint` constants can be combined with the `|` operator:

```
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;

```
To put this as an answer for 2D, use the following:

```
Rigidbody2D body2d;

void Awake() {

    body2d = GetComponent<Rigidbody2D> ();

}

void Update () {

    // on this line, calculate condition for freezing rotation

    if (condition) {

        body2d.constraints = RigidbodyConstraints2D.FreezeRotation;

    } else {

        body2d.constraints = RigidbodyConstraints2D.None;

    }

}

```