Question: So I recent got into learning php and now I find I typically follow this weird design pattern for building webpages but I don't know if its actually as smart as I think it is or it just a jumble of garbage. 

I basically use php to load the header and footer of a website, since every webpage has the same on on a website generally. I then use php to load the html for center content of each page. 

I feel that using this method I can create new web pages fast since the "template" of header and footer is already created and that it is easier for managing a website because the code is essentially like having interchangeable blocks of smaller code that just get swapped out. 

Does anyone else use this kind of method? are there similar patterns that are more efficient.

Answer: 
This is not a regular expression - it is a format string, as this is a call to `string.Format` .

This simply formats the string and places the value of the `regex` variable (or rather the result of calling `ToString()` on it) in place of the `{0}`.

The result is the string `"(?-mix:<whatever regex.ToString() is>)"`.

This string *looks* like it could be a regular expression, and would turn off a few modifiers (so this would be case sensitive, ^ and $ match start and end of line only and free spacing mode is off). See [Regular Expression Advanced Syntax Reference](http://www.regular-expressions.info/refadv.html) on [www.regular-expressions.info](http://www.regular-expressions.info).

So the above would match `regex` with those options off.
Well, a little bit late, but just in case you didn't find out what it means:

Regular expressions defines a capturing group between `(` and `)`. When you need grouping, but a non-capturing one, you will write the expression between `(?:` and `)`. And some regex processors accepts on/off flags between `?` and `:` of non-capturing group. So there goes the "mixing" stuff, which actually means turn off some flags about the group, delimited with a `-` sign (turn the flag off):

* `m modifier off`: -multi-line, ^ and $ match not only begin/end of line
* `i modifier off`: -insensitive, case sensitive match
* `x modifier off`: -extended, whitespaces in pattern are literal whitespaces

So, it becomes `(?-mix:` ... `)` when you turn them off. It's the same thing with `(?-ixm:` ... `)` or in any other order.

Anyway, I don't think Regex class of .NET cares about those flags, better check it later. It's migrated from original ruby source of liquid engine.