github.com/itchyny/rassemble-go@v0.1.1/README.md (about)

     1  # rassemble-go
     2  [![CI Status](https://github.com/itchyny/rassemble-go/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/itchyny/rassemble-go/actions?query=branch:main)
     3  [![Go Report Card](https://goreportcard.com/badge/github.com/itchyny/rassemble-go)](https://goreportcard.com/report/github.com/itchyny/rassemble-go)
     4  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/itchyny/rassemble-go/blob/main/LICENSE)
     5  [![release](https://img.shields.io/github/release/itchyny/rassemble-go/all.svg)](https://github.com/itchyny/rassemble-go/releases)
     6  [![pkg.go.dev](https://pkg.go.dev/badge/github.com/itchyny/rassemble-go)](https://pkg.go.dev/github.com/itchyny/rassemble-go)
     7  
     8  ### Go implementation of [Regexp::Assemble](https://metacpan.org/pod/Regexp::Assemble)
     9  This is a Go language package for joining regular expressions into a regular expression which matches all strings that any of the arguments matches.
    10  
    11  ```go
    12  package main
    13  
    14  import (
    15  	"fmt"
    16  	"log"
    17  
    18  	"github.com/itchyny/rassemble-go"
    19  )
    20  
    21  func main() {
    22  	xs, err := rassemble.Join([]string{"abc", "ab", "acbd", "abe"})
    23  	if err != nil {
    24  		log.Fatal(err)
    25  	}
    26  	fmt.Println(xs) // a(?:b[ce]?|cbd)
    27  }
    28  ```
    29  
    30  A command line tool is also provided.
    31  ```sh
    32   % go install github.com/itchyny/rassemble-go/cmd/rassemble@latest
    33   % rassemble abcd abd acd ad
    34  ab?c?d
    35   % rassemble $(head -n30 /usr/share/dict/words)
    36  A(?:a(?:ni|r(?:on(?:i(?:c(?:al)?|t(?:e|ic)))?|u))|b(?:ab(?:deh|ua))?)?|a(?:a(?:l(?:ii)?|m|rd(?:vark|wolf))?|ba(?:c(?:a(?:te|y)?|i(?:nat(?:e|ion)|s(?:cus|t))|k|tinal(?:ly)?)?)?)?
    37  ```
    38  
    39  ## Bug Tracker
    40  Report bug at [Issues・itchyny/rassemble-go - GitHub](https://github.com/itchyny/rassemble-go/issues).
    41  
    42  ## Author
    43  itchyny (https://github.com/itchyny)
    44  
    45  ## License
    46  This software is released under the MIT License, see LICENSE.