From d2330ba0554b09a3f942a921acfbbabcf6466bef Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 6 Apr 2000 18:44:01 +0000 Subject: 10547: (#s) and (#e) pattern assertions --- Doc/Zsh/expn.yo | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Doc') diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 9d2f035c8..172949176 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -1299,6 +1299,17 @@ item(tt(a)var(num))( Approximate matching: var(num) errors are allowed in the string matched by the pattern. The rules for this are described in the next subsection. ) +item(tt(s), tt(e))( +Unlike the other flags, these have only a local effect, and each must +appear on its own: `tt((#s))' and `tt((#e))' are the only valid forms. +The `tt((#s))' flag succeeds only at the start of the test string, and the +`tt((#e))' flag succeeds only at the end of the test string; they +correspond to `tt(^)' and `tt($)' in standard regular expressions. They +are useful for matching path segments in patterns. For example, +`tt(*((#s)|/)test((#e)|/)*)' matches a path segment `tt(test)' in any of +the following strings: tt(test), tt(test/at/start), tt(at/end/test), +tt(in/test/middle). +) enditem() For example, the test string tt(fooxx) can be matched by the pattern -- cgit 1.4.1