mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Merge remote-tracking branch 'origin/topic/vern/case-insensitive-patterns'
* origin/topic/vern/case-insensitive-patterns: use PCRE syntax instead of the beautiful new (?i ...) syntax nitlet in NEWS entry test suite update for case-insensitive patterns document use of double quotes to escape case-insensitivity bug fix for recent memory leak patch documentation updates for case-insensitive patterns d'oh there's isalpha. I looked earlier for isletter :-P fix for handling [:(lower|upper):] in case-insensitive patterns implemented /re/i for case-insensitive patterns
This commit is contained in:
commit
463e540c9b
14 changed files with 235 additions and 40 deletions
|
@ -198,9 +198,9 @@ Here is a more detailed description of each type:
|
|||
|
||||
.. bro:type:: pattern
|
||||
|
||||
A type representing regular-expression patterns which can be used
|
||||
A type representing regular-expression patterns that can be used
|
||||
for fast text-searching operations. Pattern constants are created
|
||||
by enclosing text within forward slashes (/) and is the same syntax
|
||||
by enclosing text within forward slashes (``/``) and use the same syntax
|
||||
as the patterns supported by the `flex lexical analyzer
|
||||
<http://westes.github.io/flex/manual/Patterns.html>`_. The speed of
|
||||
regular expression matching does not depend on the complexity or
|
||||
|
@ -244,13 +244,25 @@ Here is a more detailed description of each type:
|
|||
|
||||
yields true, like in the similar example above. You can also
|
||||
create the conjunction (concatenation) of patterns using the ``&``
|
||||
operator. For example:
|
||||
operator. For example::
|
||||
|
||||
/foo/ & /bar/ in "foobar"
|
||||
|
||||
will yield true because the pattern /(foo)(bar)/ appears in
|
||||
the string "foobar".
|
||||
|
||||
When specifying a pattern, you can add a final ``i`` specifier to
|
||||
mark it as case-insensitive. For example, ``/foo|bar/i`` will match
|
||||
a "foo", "Foo", "BaR", etc.
|
||||
|
||||
You can also introduce a case-insensitive sub-pattern by enclosing it
|
||||
in ``(?i:``<pattern>``)``. So, for example, ``/foo|(?i:bar)/`` will
|
||||
match "foo" and "BaR", but *not* "Foo".
|
||||
|
||||
For both ways of specifying case-insensitivity, characters enclosed
|
||||
in double quotes maintain their case-sensitivity. So for example
|
||||
/"foo"/i will not match "Foo", but it will match "foo".
|
||||
|
||||
.. bro:type:: port
|
||||
|
||||
A type representing transport-level port numbers (besides TCP and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue