The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::Snippet::TabStop::WithTransformer - Tab stop that modifies the replacement value supplied by the user

EXAMPLE SYNTAX

  • simple search/replace

            ${1/search/replace/}
  • supports standard regex flags (global, case-insensitive in this example)

            ${1/something/else/gi}
  • supports captures (capitalizes first character of replacement)

            ${1/^(.)/\U$1/}
  • for TextMate compatibility, $0 returns the entire matched string (think $&)

            # capitalize the entire replacement value
            ${1/.+/\U$0/g}

CLASS METHODS

parse

This method parses the index and transforming regular expression that are specified in the tab stop.

INSTANCE METHODS

  • transformer

    Returns a CodeRef that takes a single argument (a string) and returns a modified version of that string after applying a transformation to that string.

  • to_string

    Augments super-class' to_string method and returns the modified value after applying the transformation specified in the tab stop.