Category: Collections-Text
Superclass: Object
A Regex is a read-only string for which the regular expression matcher can cache a compiled representation, thus speeding up matching. Regex objects are constructed automatically by methods that expect to match many times the same regular expression, but can also be constructed explicitly sending #asRegex to a String or Symbol. Creation of Regex objects inside a loop is of course slower than creating them outside the loop, but special care is taken so that the same Regex object is used whenever possible (when converting Strings to Regex, the cache is sought for an equivalent, already constructed Regex).

Method category index

instance creation (class)
basic (instance)
conversion (instance)
printing (instance)

instance creation (class)

fromString: aString
Like `aString asRegex'.

new

Do not send this message.

top


basic (instance)

at: anIndex put: anObject
Fail. Regex objects are read-only.

copy

Answer the receiver; instances of Regex are identity objects because their only purpose is to ease caching, and we obtain better caching if we avoid copying Regex objects

top


conversion (instance)

asRegex
Answer the receiver, which *is* a Regex!

asString

Answer the receiver, converted back to a String

species

Answer `String'.

top


printing (instance)

displayOn: aStream
Print a represention of the receiver on aStream. For most objects this is simply its #printOn: representation, but for strings and characters, superfluous dollars or extra pairs of quotes are stripped.

displayString

Answer a String representing the receiver. For most objects this is simply its #printString, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

printOn: aStream

Print a represention of the receiver on aStream.

top