syntax:pattern

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
syntax:pattern [2021/08/23 17:12]
fgrose [Patterns and pattern matching] not to be confused with reqular expressions
syntax:pattern [2021/10/21 00:52]
fgrose links to POSIX character classes & collation symbols
Line 10: Line 10:
  
 The pattern description language is relatively easy. Any character that's not mentioned below matches itself. The pattern description language is relatively easy. Any character that's not mentioned below matches itself.
-The ''​NUL''​ character may not occur in a pattern. If special characters are quoted, they'​re matched literally, i.e. without their special meaning.+The ''​NUL''​ character may not occur in a pattern. If special characters are quoted, they'​re matched literally, i.e.without their special meaning.
  
 Do **not** confuse patterns with **//regular expressions//​**,​ because they share some symbols and do similar matching work. Do **not** confuse patterns with **//regular expressions//​**,​ because they share some symbols and do similar matching work.
Line 31: Line 31:
 |''​[XYZ]''​|The "​normal"​ bracket expression, matching either ''​X'',​ ''​Y''​ or ''​Z''​| |''​[XYZ]''​|The "​normal"​ bracket expression, matching either ''​X'',​ ''​Y''​ or ''​Z''​|
 |''​[X-Z]''​|A range expression: Matching all the characters from ''​X''​ to ''​Y''​ (your current **locale**, defines how the characters are **sorted**!)| |''​[X-Z]''​|A range expression: Matching all the characters from ''​X''​ to ''​Y''​ (your current **locale**, defines how the characters are **sorted**!)|
-|''<​nowiki>​[[:​class:​]]</​nowiki>''​|Matches all the characters defined by a POSIX(r) character class: ''​alnum'',​ ''​alpha'',​ ''​ascii'',​ ''​blank'',​ ''​cntrl'',​ ''​digit'',​ ''​graph'',​ ''​lower'',​ ''​print'',​ ''​punct'',​ ''​space'',​ ''​upper'',​ ''​word''​ and ''​xdigit''​|+|''<​nowiki>​[[:​class:​]]</​nowiki>''​|Matches all the characters defined by a [[https://​pubs.opengroup.org/​onlinepubs/​009696899/​basedefs/​xbd_chap07.html#​tag_07_03_01|POSIX(r) character class]]: ''​alnum'',​ ''​alpha'',​ ''​ascii'',​ ''​blank'',​ ''​cntrl'',​ ''​digit'',​ ''​graph'',​ ''​lower'',​ ''​print'',​ ''​punct'',​ ''​space'',​ ''​upper'',​ ''​word''​ and ''​xdigit''​|
 |''​[^...]''​|A negating expression: It matches all the characters that are **not** in the bracket expression| |''​[^...]''​|A negating expression: It matches all the characters that are **not** in the bracket expression|
 |''​[!...]''​|Equivalent to ''​[^...]''​| |''​[!...]''​|Equivalent to ''​[^...]''​|
Line 60: Line 60:
     * => ''​Hello world+''​     * => ''​Hello world+''​
     * => ''​Hello world?''​     * => ''​Hello world?''​
-  * Pattern ''<​nowiki>​[[.backslash.]]Hello[[.vertical-line.]]world[[.exclamation-mark.]]</​nowiki>''​ matches (using collation ​sybols)+  * Pattern ''<​nowiki>​[[.backslash.]]Hello[[.vertical-line.]]world[[.exclamation-mark.]]</​nowiki>''​ matches (using ​[[https://​pubs.opengroup.org/​onlinepubs/​009696899/​basedefs/​xbd_chap07.html#​tag_07_03_02_04|collation ​symbols]])
     * => ''​\Hello|world!''​     * => ''​\Hello|world!''​
  
  • syntax/pattern.txt
  • Last modified: 2021/10/21 00:52
  • by fgrose