4191 |
4191 |
4192 ^ aPatternString match:self |
4192 ^ aPatternString match:self |
4193 ! ! |
4193 ! ! |
4194 |
4194 |
4195 |
4195 |
4196 !CharacterArray methodsFor:'matching - regex'! |
4196 |
4197 |
|
4198 hasAnyRegexMatches: rxString |
|
4199 "return true, if any substrings in the receiver, matches the regular expression in rxString" |
|
4200 |
|
4201 rxString asRegex matchesIn:self do:[:m | ^ true]. |
|
4202 ^ false |
|
4203 |
|
4204 " |
|
4205 '1234 abcd 3456 defg' hasAnyRegexMatches:'[0-9]+' |
|
4206 'abcd 3456 defg' hasAnyRegexMatches:'[0-9]+' |
|
4207 'abcd xxax defg' hasAnyRegexMatches:'[0-9]+' |
|
4208 " |
|
4209 |
|
4210 "Created: / 13-08-2010 / 17:09:05 / sr" |
|
4211 ! |
|
4212 |
|
4213 hasAnyRegexMatches: rxString ignoringCase:aBoolean |
|
4214 "return true, if any substrings in the receiver, matches the regular expression in rxString" |
|
4215 |
|
4216 aBoolean ifTrue:[ |
|
4217 ^ self hasAnyRegexMatchesIgnoringCase: rxString |
|
4218 ] ifFalse:[ |
|
4219 ^ self hasAnyRegexMatches: rxString |
|
4220 ]. |
|
4221 |
|
4222 " |
|
4223 '1234 abcd 3456 defg' hasAnyRegexMatches:'[0-9]+' |
|
4224 'abcd 3456 defg' hasAnyRegexMatches:'[0-9]+' |
|
4225 'abcd xxax defg' hasAnyRegexMatches:'[0-9]+' |
|
4226 'arith [arc]' hasAnyRegexMatches:'(ab)+' |
|
4227 'arith [arc]' hasAnyRegexMatches:'(ab)*' |
|
4228 " |
|
4229 |
|
4230 "Created: / 13-12-2010 / 11:03:05 / cg" |
|
4231 ! |
|
4232 |
|
4233 hasAnyRegexMatchesIgnoringCase: rxString |
|
4234 "return true, if any substrings in the receiver, matches the regular expression in rxString" |
|
4235 |
|
4236 rxString asRegexIgnoringCase matchesIn:self do:[:m | ^ true]. |
|
4237 ^ false |
|
4238 |
|
4239 " |
|
4240 'ABCD XYZ DEFG' hasAnyRegexMatchesIgnoringCase:'[a-z]+' |
|
4241 'ABCD XYZ DEFG' hasAnyRegexMatches:'[a-z]+' |
|
4242 |
|
4243 '1234 abcd 3456 defg' hasAnyRegexMatchesIgnoringCase:'[a-z]+' |
|
4244 'abcd 3456 defg' hasAnyRegexMatchesIgnoringCase:'[a-z]+' |
|
4245 " |
|
4246 |
|
4247 "Created: / 13-08-2010 / 17:11:11 / sr" |
|
4248 ! |
|
4249 |
|
4250 matchesRegex:regexString ignoringCase:aBoolean |
|
4251 "Test if the receiver matches a regex. |
|
4252 May raise RxParser>>regexErrorSignal or child signals. |
|
4253 This is a part of the Regular Expression Matcher package, |
|
4254 (c) 1996, 1999 Vassili Bykov. |
|
4255 Refer to `documentation' protocol of RxParser class for details." |
|
4256 |
|
4257 aBoolean ifTrue:[ |
|
4258 ^ self matchesRegexIgnoringCase:regexString |
|
4259 ] ifFalse:[ |
|
4260 ^ self matchesRegex:regexString |
|
4261 ]. |
|
4262 |
|
4263 " |
|
4264 'hello world' matchesRegex:'h.*d'. |
|
4265 " |
|
4266 |
|
4267 "Created: / 13-12-2010 / 11:01:49 / cg" |
|
4268 ! ! |
|
4269 !CharacterArray methodsFor:'padded copying'! |
4197 !CharacterArray methodsFor:'padded copying'! |
4270 |
4198 |
4271 centerPaddedTo:newSize |
4199 centerPaddedTo:newSize |
4272 "return a new string consisting of the receivers characters, |
4200 "return a new string consisting of the receivers characters, |
4273 plus spaces up to length and center the receivers characters in |
4201 plus spaces up to length and center the receivers characters in |
4784 " |
4712 " |
4785 |
4713 |
4786 "Created: 12.5.1996 / 20:09:29 / cg" |
4714 "Created: 12.5.1996 / 20:09:29 / cg" |
4787 "Modified: 17.4.1997 / 12:50:23 / cg" |
4715 "Modified: 17.4.1997 / 12:50:23 / cg" |
4788 ! ! |
4716 ! ! |
|
4717 |
4789 |
4718 |
4790 !CharacterArray methodsFor:'special string converting'! |
4719 !CharacterArray methodsFor:'special string converting'! |
4791 |
4720 |
4792 expandPlaceholdersWith:argArrayOrDictionary |
4721 expandPlaceholdersWith:argArrayOrDictionary |
4793 "return a copy of the receiver, where all %i escapes are |
4722 "return a copy of the receiver, where all %i escapes are |