Thursday, 15 January 2015

php - Recursive subpattern regex -


I want to read the name of the server from a nginx config file.
Then I need to rotate a line again:
server_name this.com www.this.com someother-example.com;

I am using PHP's preg_match_all and I've tried different things so far:
/ ^ (?: Server_name [\ s] *) (?: (.: * (?: \ S *)) * $ / m : which gives me nothing / ^ (?: Server_name [\ s] *) ((?: (? :. *) (?: \ S *)) *); $ / M gives me this www www. This.com someother-example.com

but I can not find the right to list the domain as a different value

  [0 = & gt; 'This.com', 1 = & gt; 'Www.this.com', 2 = & gt; Perhaps, one of you know?  

Thank you!

As your uncle of Bob wrote: "post-text" itemprop = "text">

:

(?: Server_name | \ G (?! ^)) \ S * \ K [^; | \ S] +

What a move!


No comments:

Post a Comment