GithubHelp home page GithubHelp logo

selectbyregex's Introduction

Select By Regex

This Sublime Text 3 plugin will prompt you for a regular expression, then create multiple selections from all of the matches to that regular expression. The range of the search is limited to the current selection. If nothing is selected, then the this command will imply the current line.

Example:

This, is, an, example

Select By Regex: ,

This[,] is[,] an[,] example

Usage:

After installing, use the command palette and search for "Select By Regex". This brings up the Regex input box at the bottom of the screen. Type in a regular expression and press ENTER, or ESCAPE to cancel.

This can be very useful for splitting a line by commas. You can run the command, then press RIGHT and your cursor(s) will be after every comma. Then just press ENTER.

Keybind:

To bind this to a key, enter the following in your user keybinds file:

{
    "keys": ["super+alt+shift+f"], "command": "select_by_regex",
}

Credits:

Special thanks to klorenz for helping with the ST2 compatibility.

selectbyregex's People

Contributors

klorenz avatar tarwich avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

klorenz

selectbyregex's Issues

Debounce on_change?

When using on a big selection, typing in the box triggers the preview on each keypress. When I tried that on 1500ish lines, sublime/python can't handle it.

I'd consider implementing a debounced method, so that the preview updates say 500ms after the last keypress. Opinion? I can write the code and create a pull request if you will.

Merge with SublimeSelectRegex?

Hi. I've already had similar non-publised plugin: https://github.com/mvoidex/SublimeSelectRegex, which is very similar to your plugin, but have some differences and advantages:

  • Allows selecting group, not full regex
  • Allows matching for selected text (foo$_ matches foobar if bar was selected)
  • Can select next regex or all regexes
  • This works well: #4
  • But 'select regex: all' differs: it selects all regexes in selection without restriction to single line, so if you want to select regexes in lines, you have to use 'expand selection to line' command

Having two similar plugins is not good idea, can we merge them somehow?

Native implementation

How is this different than selecting a text and pressing Alt F3? Or doing a regex search and pressing "find all" button.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.