Changes between Version 3 and Version 4 of soc/2007/RegexRecursiveMatch


Ignore:
Timestamp:
Jul 16, 2007, 4:51:56 PM (15 years ago)
Author:
hughwimberly
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • soc/2007/RegexRecursiveMatch

    v3 v4  
    2727There'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:
    2828
    29 ```(?P<name>pattern)```::
     29```(?P<name>pattern)```
    3030  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.
    3131
    32 ```(?P=name)```::
     32```(?P=name)```
    3333  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.
    3434
    35 ```m["name"]```::
     35```m["name"]```
    3636  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.
    3737