Help us understand the problem. What is going on with this article?

テキストマッチツール

More than 1 year has passed since last update.

テキストマッチするツール公開しました。シンタックスチェックとかで使えると思います。

https://github.com/S-YOU/match

(一旦matchという名前を付けています。特許の侵害で訴えられたら変更を検討しますw)

以下、Githubと同じく英語ですmm

Match

  • Line Matcher for text data, like grep but more opinionated.

Usage

  • match vars.conf TEMPLATE < INPUT_FILE

File formats

  • vars.conf (example)
ANY = \S+
NUM = \d+
  • template.conf (example, any text that will match with INPUT_FILE)
The quick brown fox jumps over the lazy dog NUM times
The quick brown ANY jumps over the lazy dog NUM times
  • INPUT_FILE (any text that will match with TEMPLATE)
The quick brown fox jumps over the lazy dog 100 times
The quick brown fox jumps over the lazy dog X times
The quick brown cow jumps over the lazy dog 100 times
The quick brown cow jumps over the lazy dog 100

Output for above example

% ./match examples/vars.conf examples/template.conf < examples/input.txt
[Line: 2] Unrecognized token. Expected: NUM: /^\d+/
The quick brown fox jumps over the lazy dog X times
                                            ^
[Line: 4] Incomplete line. Expected: times
The quick brown cow jumps over the lazy dog 100
                                                ^^^
Total: 5 lines, Processed 4 lines in 0.118 ms, found  2  issue(s)

Screenshot

スクリーンショット 2018-05-12 23.03.19.png

License

  • MIT

Note

  • Release binary on OSX is dynamic, and static on linux

Limitations

  • VARS(Regex) and plain texts cannot overrlap (only one will be chosen)

    • abc(TEXT) and abc*(VARS)
  • No backtracking, when there is two route a->B->c, and a->Z->y

    • if B is chosen and c does not match, program will not attempt to backtrack to c->Z->y
  • Using unsafe semantics, it may segfault or harm your computer. Use at your own risk.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away