Help us shape the future of Go! Take the 2026 Go Developer Survey

expr

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package expr implements the `expr` built-in.

expr evaluates a single expression made of operators and operands. Operator precedence (lowest → highest):

|                logical or
&                logical and
= != < > <= >=   comparison
+ -              addition / subtraction
* / %            multiplication / division / modulo
: STRING         regex anchor-match (BRE), returns matched substring or length
( EXPR )         grouping

String comparisons fall through to numeric when both sides parse as integers. expr exits with:

0 if the result is non-zero AND non-empty
1 if the result is 0 or empty
2 on syntax error (and writes "expr: ..." to stderr)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() command.Command

New returns the expr command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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