CharacterArray.st
branchjv
changeset 18115 26ac4840e5d0
parent 18112 0d7ac9096619
parent 15890 bb7a0307b078
child 18117 eb433f2c42b2
--- a/CharacterArray.st	Wed Dec 18 18:48:33 2013 +0100
+++ b/CharacterArray.st	Mon Jan 13 11:46:28 2014 +0000
@@ -4060,7 +4060,7 @@
      NOTICE: this is GLOB, which is different from regex matching (see matchesRegex:)
      NOTICE: the receiver is the match pattern"
 
-    ^self compoundMatch:aString caseSensitive:true
+    ^ self compoundMatch:aString caseSensitive:true withoutSeparators:false
 
     "
      'f*' match:'foo'
@@ -4085,9 +4085,40 @@
      NOTICE: this is GLOB, which is different from regex matching (see matchesRegex:)
      NOTICE: the receiver is the match pattern"
 
+    ^self compoundMatch:aString caseSensitive:caseSensitive withoutSeparators:false
+
+    "
+     'f*' match:'foo'
+     'b*' match:'foo'
+     'f*;b*' match:'foo'
+     'f*;b*' match:'bar'
+     'f*;b*' compoundMatch:'foo'
+     'f*;b*' compoundMatch:'bar'
+     'f*;b*' compoundMatch:'Foo' caseSensitive:false
+     'f*;b*' compoundMatch:'Bar' caseSensitive:false
+     'f*;b*' compoundMatch:'ccc' caseSensitive:false
+    "
+
+    "Modified: / 15.4.1997 / 15:50:33 / cg"
+    "Modified: / 30.1.1998 / 11:40:18 / stefan"
+    "Created: / 16.12.1999 / 01:21:35 / cg"
+!
+
+compoundMatch:aString caseSensitive:caseSensitive withoutSeparators:withoutSeparators
+    "like match, but the receiver may be a compound match pattern,
+     consisting of multiple simple GLOB patterns, separated by semicolons.
+     If withoutSeparators is true, spaces around individual patterns are stripped off.
+     This is usable with fileName pattern fields.
+
+     NOTICE: match-meta character interpretation is like in unix-matching (glob),
+             NOT the ST-80 meaning.
+     NOTICE: this is GLOB, which is different from regex matching (see matchesRegex:)
+     NOTICE: the receiver is the match pattern"
+
     |matchers|
 
     matchers := self asCollectionOfSubstringsSeparatedBy:$;.
+    withoutSeparators ifTrue:[ matchers := matchers collect:[:each | each withoutSeparators] ].
     ^ matchers 
         contains:[:aPattern |
             aPattern match:aString ignoreCase:caseSensitive not escapeCharacter:nil
@@ -4103,6 +4134,9 @@
      'f*;b*' compoundMatch:'Foo' caseSensitive:false
      'f*;b*' compoundMatch:'Bar' caseSensitive:false
      'f*;b*' compoundMatch:'ccc' caseSensitive:false
+
+     'f* ; b*' compoundMatch:'foo' 
+     'f* ; b*' compoundMatch:'foo' caseSensitive:true withoutSeparators:true
     "
 
     "Modified: / 15.4.1997 / 15:50:33 / cg"
@@ -6852,11 +6886,11 @@
 !CharacterArray class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.519 2013-11-26 13:02:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.520 2014-01-05 12:27:34 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.519 2013-11-26 13:02:16 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.520 2014-01-05 12:27:34 cg Exp $'
 !
 
 version_HG