aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Mikhirev2014-11-18 16:15:56 +0300
committerDmitry Mikhirev2014-11-18 16:15:56 +0300
commit85eb0d98bb8d78ba2c7a5f10e2d77ffd8ddf4d73 (patch)
tree65373ab4ecfaaae2960064c7fa50c52d18138682
parent878c75eb60a06d12e283c6e84b9cc214db2cbad3 (diff)
downloadmake_pcre-85eb0d98bb8d78ba2c7a5f10e2d77ffd8ddf4d73.tar.gz
make_pcre-85eb0d98bb8d78ba2c7a5f10e2d77ffd8ddf4d73.tar.bz2
make_pcre-85eb0d98bb8d78ba2c7a5f10e2d77ffd8ddf4d73.tar.xz
make_pcre-85eb0d98bb8d78ba2c7a5f10e2d77ffd8ddf4d73.zip
README update
-rw-r--r--README.md17
1 files changed, 15 insertions, 2 deletions
diff --git a/README.md b/README.md
index 4cf310a..e420630 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ To get plugin built, simply type
in source directory. Optionally, type
- $ make check
+ $ make -k check
to run self-tests.
@@ -52,12 +52,25 @@ not expanded, but IN is expanded before search.
Capturing strings
-----------------
+### Capture by number ###
+
When matching found, `pcre_find` sets variable `$(0)` to whole matched string
and variables `$(1)`, `$(2)`, ... to substrings captured by round brackets
-(like perl does). Maximum number of strings that can be captured is 256 (`$(0)`
+(like Perl does). Maximum number of strings that can be captured is 256 (`$(0)`
to `$(255)`). These variables can be used until the next `pcre_find` call
because it will reset them.
+### Capture by name ###
+
+`pcre_find` also provides ability to set named variables to matched substrings.
+It can be useful if you want to preserve captured value after another matching
+function called or if your pattern is quiet complicated, and it is difficult
+to handle substring numbers.
+
+In PCRE, a subpattern can be named in one of three ways: `(?<name>...)`
+or `(?'name'...)` as in Perl, or `(?P<name>...)` as in Python. If pattern
+matches, variable `$(name)` will be set to matched substring.
+
Options
-------