regex &align:%HORIZONTAL%|%VERTICAL%

I would like to have a regex that matches something like this:


%HORIZONTAL% may be "left" or "right" or "center"

%VERTICAL% may be "top" or "bottom" or "center"

I tried something like this:


And I got this:

[0] => &align:left|center
[1] => left
[2] => top

What would I have to change to get only one match at all? The [1] and [2] must not be possible.


Parentheses serve two purposes — grouping and capturing. To get the grouping you want without capturing the matches, use ?::


Manual reference:

Need Your Help

Assign Event Programmatically to Child Inside FormView

c# event-handling formview

I realize you can declaratively assign an event handler to a child control inside a formview by adding its attribute on the aspx page (i.e. onclick="Button_Click"), but if I wanted to do this

How do I develop against OAuth locally?

python oauth

I'm building a Python application that needs to communicate with an OAuth service provider. The SP requires me to specify a callback URL. Specifying localhost obviously won't work. I'm unable t...