aboutsummaryrefslogtreecommitdiff
path: root/Lua/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'Lua/README.md')
-rw-r--r--Lua/README.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lua/README.md b/Lua/README.md
index 1288696..3b6124b 100644
--- a/Lua/README.md
+++ b/Lua/README.md
@@ -12,11 +12,11 @@ The Lua `bp` bindings provide the following methods:
bp.match(pattern, text, [start_index]) --> match / nil
bp.replace(pattern, replacement, text, [start_index]) --> text_with_replacements, num_replacements
bp.compile(pattern) --> pattern_object
-for m in bp.eachmatch(pattern, text, [start_index]) do ... end
+for m in bp.matches(pattern, text, [start_index]) do ... end
pattern_object:match(text, [start_index]) --> match / nil
pattern_object:replace(replacement, text, [start_index]) --> text_with_replacements, num_replacements
-for m in pattern_object:eachmatch(text, [start_index]) do ... end
+for m in pattern_object:matches(text, [start_index]) do ... end
```
Match objects returned by `bp.match()` are tables whose `__tostring` will
@@ -32,7 +32,7 @@ unambiguous.
Pattern objects returned by `bp.compile()` are pre-compiled patterns that are
slightly faster to reuse than just calling `bp.match()` repeatedly. They have a
`.source` attribute that holds the original text used to compile them and have
-`:match()`, `:replace()`, and `:eachmatch()` methods as described above.
+`:match()`, `:replace()`, and `:matches()` methods as described above.
All methods will raise an error with a descriptive message if the given pattern
has a syntax error.
@@ -47,13 +47,13 @@ local m = bp.match('"n" @Es=+`e "dle"', "like finding a needle in a haystack")
local replaced, nreplacements = bp.match('"n" +`e "dle"', "cat", "like finding a needle in a haystack")
--> "like finding a cat in a haystack", 1
-for word in bp.eachmatch("+`A-Z,a-z", "one, two three... four!") do
+for word in bp.matches("+`A-Z,a-z", "one, two three... four!") do
print(word) --> prints "one" "two" "three" "four"
end
local pat = bp.compile("word parens")
for _,s in ipairs(my_strings) do
- for fncall in pat:eachmatch(s) do
+ for fncall in pat:matches(s) do
print(fncall)
end
end