No commit activity in last 3 years
No release in over 3 years
Embulk filter plugin to convert text column values with regular expressions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.0
>= 10.0
 Project Readme

Gsub filter plugin for Embulk

CircleCI

Embulk filter plugin to convert text column values with regular expressions.

Overview

  • Plugin type: filter

Configuration

  • target_columns: columns to convert text value (array, default: [])

Example

filters:
  - type: gsub
    target_columns:
      foo:
        - type: regexp_replace
          pattern: '(\w*):\s*(\w*)'
          to: "$1 = [$2]"
      bar:
        - type: to_lower_case
      baz:
        - type: to_upper_case
          pattern: "test"

target column configuration

  • type: type of text substitution (string, default: regexp_replace)

Supported Types are:

  • regexp_replace
  • to_lower_case
  • to_upper_case

regexp_replace

  • pattern: regular expression pattern to be substituted (string, required)
  • to: replacement string (string, required)
Example
target_columns:
  foo:
    - type: regexp_replace
      pattern: '(\w*):\s*(\w*)'
      to: "$1 = [$2]"

it converts input like this

foo bar
example-foo: 1234 example-bar: 9876

into the output

foo bar
example-foo = [1234] example-bar: 9876

to_lower_case

  • pattern: regular expression pattern to be substituted (string, optional)

If pattern is omitted, whole text is converted into lower case letters.

Example
target_columns:
  foo:
    - type: to_lower_case

it converts input like this

foo bar
ABC XYZ

into the output

foo bar
abc XYZ

to_upper_case

  • pattern: regular expression pattern to be substituted (string, optional)

If pattern is omitted, whole text is converted into upper case letters.

Example
target_columns:
  foo:
    - type: to_upper_case

it converts input like this

foo bar
abc xyz

into the output

foo bar
ABC xyz

Multiple conversion

You can apply multiple conversion on a column value.

target_columns:
  foo:
    - type: regexp_replace
      pattern: '</?\w*\s*/?>'
      to: ""
    - type: regexp_replace
      pattern: '(\w*):\s*(\w*)'
      to: "$1 = [$2]"

Regular expression options

You can specify some regular expression options.

target_columns:
  foo:
    - type: regexp_replace
      pattern: 'foo'
      to: "***"
      regexp_options:
        ignore_case: true

Supported options are:

  • ignore_case (boolean, default: false)
  • multiline (boolean, default: true)
  • dot_matches_all (boolean, default: false)
  • enable_comments (boolean, default: false)

Build

$ ./gradlew gem  # -t to watch change of files and rebuild continuously