[String] findPattern: [String] do: [Block] options: [String]. | Manual

[String] findPattern: [String] do: [Block] options: [String].

Matches the POSIX regular expression in the first argument against the string and executes the specified block on every match passing an array containing the matches. The options parameter can be used to pass specific flags to the regular expression engine. As of the moment of writing this functionality has not been implemented yet. The only flag you can set at this moment is the 'ignore' flag, just a test flag. This flag does not execute the block.

 'hello world' findPattern: '([hl])' do: { :arr
  Pen write: (arr join: '|'), brk.
 } options: ''.

 On every match the block gets executed and the matches are
 passed to the block as arguments. You can also use this feature to replace
 parts of the string, simply return the replacement string in your block.

back to homepage
back to manual menu

This API reference guide has been generated automatically from source code comments using the shtml.ctr script.