npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-regex-shuffler

v0.2.3

Published

Use regular expressions to shuffle around text!

Downloads

53

Readme

gulp-regex-shuffler

npm version Build Status

Installation

npm install --save-dev gulp-regex-shuffler

Description

use this gulp plugin to cut and paste text via regular expressions within a file.

Usage

var regexCutAndPaste = require('gulp-regex-shuffler');

gulp.task('move-text', function() {
    return gulp.src('*.txt')
        .pipe(regexCutAndPaste(/move this text\n/g, /^/g)
        .pipe(gulp.dest('dist'));
});

This will take the text move this text and place it after the line text goes here. e.g.

some line
move this text

Will become

text goes here
some line

API

Syntax

function(cutRegex, pasteRegex[, opts]) {...}

Arguments

cutRegex

  • Required: true
  • Type: RegExp|String
  • Description: regular expression used to define what to cut out. Currently only supports regexps with global modifiers but future support is planned.
  • Example: /ab*c/g OR 'ab*c'

pasteRegex

  • Required: true
  • Type: RegExp|String
  • Example: /ab*c/g OR 'ab*c'
  • Description: regular expression used to define where to paste. Currently only supports regexps with global modifiers but future support is planned.

opts

  • Required: false
  • Type: object
  • Description: used to configure the plugin, see [options]
  • Example: {verbose: true, pasteBefore: true, captureGroup: 1}

Options

opts.verbose

  • Default: false
  • Type: boolean
  • Description: whether to output debug information or not.

opts.pasteBefore

  • Default: false
  • Type: boolean
  • Description: determines whether the text found with the cutRegex argument will be pasted before or after the text found with pasteRegex

opts.captureGroup

  • Default: 0
  • Type: number
  • Description: an integer >= 0. describes the capture group that will be cut from the matching text.

Planned Improvements

  • Arbitrary cut and paste objects. Using String(objectToInjectIntoText) on whatever is passed into the first argument to allow for anything to be placed where the pasteRegex specifies
  • handle streams (still have to learn a bit more about streams before i complete this. If anyone can lead me to a comprehensive document on this i would be greatful :)
  • multiple match, cut and pastes using non-global regexes. e.g. /$\s*\Shello\S\s*^/m would find every string with the text hello in it and paste each one one after the other or all together according to the provided options. There are a few scenarios I'll need to cater for so this change might take a while.