Negating a subpattern

From: Date: Sun, 11 May 2003 13:53:45 +0000
Subject: Negating a subpattern
Groups: php.general 
Request: Send a blank email to php-general+get-147202@lists.php.net to get a copy of this message
Hi I have the following regexp #\[(template|wordlet) ([^\]]+)\]([^\[]*)#ism It gives me sections of my configuration file. As I understand it's working like find [template or wordlet, then space, then something but ] one ore more times, then something but [ zero or more times. Here is example: [template a1] This is a test info [template a2] This is another info [wordlet b1] Some other stuff goes here. It works fine as long as under the section I don't have [ or ]. Now I want to modify it in order to support square brackets as information like this. [template a1] This is another info which contains square brackets like this test[1234] [template a2... I tried to search across PHP docs but I didn't found how to describe the following expression: find [template or wordlet, then space, then something but ] one ore more times, then something but [template or [wordlet zero or more times. At the same time I want to keep all subpattern boundaries I defined as they are in first expression. It seems to me that I can't negate a subpattern... Any help will be appreciated.

« previous php.general (#147202) next »