Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions mrbgems/mruby-regexp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ simulation) with backtracking fallback.
- `(?<=...)` positive lookbehind (fixed-length only)
- `(?<!...)` negative lookbehind (fixed-length only)

### Character Escapes

- `\n`, `\t`, `\r`, `\f`, `\v`, `\a`, `\e` control characters
- `\NNN` octal, one to three digits
- `\xHH` hex, one or two digits
- `\uXXXX` Unicode codepoint, exactly four hex digits
- `\u{...}` Unicode codepoints, one to six hex digits each, several of
them separated by spaces: `/\u{61 62}/` is `ab`

Outside a character class the list form is a sequence rather than one
atom, so a quantifier after it repeats the last codepoint only:
`/\u{61 62}+/` is `ab+`. Inside a class every codepoint is a member of
its own, and the last one can still open a range: `/[\u{61 62}-z]/` is
`a` plus `b-z`.

### Anchors

- `^` beginning of line
Expand Down Expand Up @@ -148,6 +163,8 @@ pattern analysis.
Maximum 255 bytes.
- **No Unicode properties**: `\p{Alpha}`, `\p{L}`, etc. are not
supported.
- **No `\x{...}` hex escape**: the hex escape is `\xHH`, so it reaches
`0xff` at most. Write `\u{...}` for a codepoint above that.
- **ASCII case folding by default**: The `i` flag handles ASCII letters
only unless the build defines `MRB_REGEXP_UNICODE_CASE`, which adds the
Unicode foldings that pair one codepoint with one other. Without the
Expand Down
1 change: 1 addition & 0 deletions mrbgems/mruby-regexp/include/re_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ void mrb_re_free(mrb_state *mrb, mrb_regexp_pattern *pat);
/* UTF-8 helpers */
int mrb_re_utf8_charlen(const char *s, const char *end);
uint32_t mrb_re_utf8_decode(const char *s, const char *end, int *len);
int mrb_re_utf8_encode(uint32_t cp, char *buf);
mrb_bool mrb_re_is_word_char(uint32_t c);

/* The two foldings whose result is an ASCII letter. Every build carries them,
Expand Down
Loading
Loading