Changes between Version 3 and Version 4 of soc/2007/RegexRecursiveMatch
- Timestamp:
- Jul 16, 2007, 4:51:56 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
soc/2007/RegexRecursiveMatch
v3 v4 27 27 There's a pretty good overview of existing practice for all of this [http://www.regular-expressions.info/named.html here]. .NET supports named captured, but uses different syntax than everybody else, so Boost.Regex is using the more widely-used Python syntax. Specifically, Boost.Regex now allows the following regular expression syntax: 28 28 29 ```(?P<name>pattern)``` ::29 ```(?P<name>pattern)``` 30 30 if ''pattern'' is a valid regular expression, then it is captured and assigned to the group named ''name''. The group is also assigned a number that can be used to recall it or as a backreference; this number is the same as it would be if the group were simply an ordinary capture group (i.e. its number in order). At this point ''name'' may contain any character other than ```>```, but this will probably be restricted to alphabetic or alphanumeric names. Note that a ```)``` will prevent backreferences using this name. A name may be used only once in a given regex. 31 31 32 ```(?P=name)``` ::32 ```(?P=name)``` 33 33 is a backreference to the capture group identified by ```name```. Fails if no previous group has such name. Currently, ```name``` can contain any character other than ```)```, but this will be eventually restricted to the same character set allowed by named captures. 34 34 35 ```m["name"]``` ::35 ```m["name"]``` 36 36 if ```m``` is a submatch object that has been used in the matching of a regular expression with a named capture group ```name```, then this returns that capture group. 37 37