regexpop

package
v0.5.46 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 1 Imported by: 0

README

サンプルリスト

このディレクトリには以下のサンプルがあります。

file example name note

Documentation

Overview

Package regexpop -- 正規表現についてのサンプルが配置されているパッケージです。

Goのregexpパッケージは、他の言語の正規表現ライブラリと比べて遅いと言われている。 理由は、安全性と予測可能性を優先した設計となっているため。 実装は RE2 系で、最悪ケースでも線形時間に収まるようにしている。 つまり、指数爆発を避ける設計となっている。

基本的に、多くのケースでは Go の regexp は十分速い。

Goにおける文字列処理の基本は

  • 正規表現はループ内で毎回 MustCompile しない。
  • 単純な判定なら strings.Contains や HasPrefix を優先する。
  • 抽出対象が決まっているなら regexp よりパース処理のほうが速くて読みやすいことが多い。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegister

func NewRegister() mapping.Register

NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL