@haxcms/migrate-regex
Search and replace regex patterns in a HAXcms site.
Last updated 3 months ago by heymp .
Apache 2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @haxcms/migrate-regex 
SYNC missed versions from official npm registry.

@haxcms/migrate-regex

Install

$ npm install -g @haxcms/migrate-regex
$ migrate-regex COMMAND
running command...
$ migrate-regex (-v|--version|version)
@haxcms/migrate-regex/0.0.3 darwin-x64 node-v10.12.0
$ migrate-regex --help [COMMAND]
USAGE
  $ migrate-regex COMMAND
...
$ npm install -g @haxcms/migrate-regex
$ migrate-regex COMMAND
running command...
$ migrate-regex (-v|--version|version)
@haxcms/migrate-regex/0.0.0 darwin-x64 node-v10.12.0
$ migrate-regex --help [COMMAND]
USAGE
  $ migrate-regex COMMAND
...

Usage

Define patterns and replacements

In your HAXcms site, create a file called migrate.json. By default migrate-regex will assume this file is a sibling of site.json.

Define your patterns in the regex property. Example:

{
  "regex": [
    {
      "pattern": "<",
      "replacement": "<"
    },
    {
      "pattern": "&gt;",
      "replacement": ">"
    },
    {
      "pattern": "&quot;",
      "replacement": "\""
    },
    {
      "pattern": "(\\$\\$(?:(?!\\$\\$)[\\s\\S])*?)(<\/?em>)([\\s\\S]*?\\$\\$)",
      "replacement": "$1_$3"
    },
    {
      "pattern": "(\\$\\$)([^\\$\\$]*)(\\$\\$)",
      "replacement": "<lrn-math>$2</lrn-math>"
    }
  ]
}

Run regex migration

$ migrate-regex run -j site.json

Current Tags

  • 0.0.3                                ...           latest (3 months ago)

1 Versions

  • 0.0.3                                ...           3 months ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (5)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |