Feoramund
09690691b6
text/regex: Remove old docmentation and unneeded flag
...
`Unsupported_Flag` was used back when the iterator did not handle
`.Multiline`.
2025-06-20 10:45:48 -04:00
Feoramund
35b157ac83
Fix multiline RegEx iteration
...
In `.Multiline` mode:
- `^` is now defined to assert the start of the string or that a "\n" or
"\r" rune was parsed on last VM dispatch.
- `$` is now defined to consume a newline sequence of "\n", "\r", or
"\r\n" or to assert the end of the string.
2025-05-26 14:48:45 -04:00
Feoramund
37d6491300
Remove Global RegEx flag, default to unanchored patterns
2025-05-24 07:42:04 -04:00
Feoramund
fedb9efb41
Make RegEx VM restartable and fix iterator infinite loop
2025-05-24 07:23:04 -04:00
Jeroen van Rijn
716bd479a9
Disallow .Multiline in iterator.
2025-04-07 21:33:57 +02:00
Jeroen van Rijn
2b26c0b39e
Remove now unused field.
2025-04-07 15:02:36 +02:00
Jeroen van Rijn
a5e513567b
Optimize regex match iterator.
...
Reuse virtual machine and capture groups between matches.
2025-04-07 14:58:41 +02:00
Jeroen van Rijn
9a2b6c01aa
Return loop index in regex iterator.
2025-04-06 21:45:37 +02:00
Jeroen van Rijn
66077add33
{.Glboal} implicit in regex allocator.
2025-04-06 21:13:02 +02:00
Jeroen van Rijn
cdc56dc691
Add iterator for core:text/regex.
...
Usage:
```odin
haystack := `xxfoobarxfoobarxx`
pattern := `f(o)ob(ar)`
it := regex.create_iterator(haystack, pattern, {.Global}) or_return
defer regex.destroy(it)
for capture in regex.match(&it) {
fmt.println(capture)
}
```
2025-04-06 14:19:14 +02:00
Ycros
7edc46f1b9
fix: regex's match_with_preallocated_capture returning num_groups
2024-12-04 13:51:27 +11:00
Feoramund
8f5b838a07
Review manual for loops in core:text/regex
2024-08-05 03:49:29 -04:00
Feoramund
14858309f0
Add explicit license info to core:text/regex
2024-08-04 19:18:16 -04:00
Feoramund
e17fc8272b
Document rationale behind RegEx shorthand classes
2024-08-04 19:12:46 -04:00
Feoramund
dde42f0ebc
Add more documentation for core:text/regex API
2024-08-04 18:56:29 -04:00
Feoramund
1ccb0b2558
Remove unused code
2024-08-04 18:56:29 -04:00
Feoramund
babdc432e9
Move Flag_To_Letter to core:text/regex/common
2024-08-04 18:56:25 -04:00
Feoramund
d3a51e208d
Hide Regular_Expression values
...
We don't directly support printing these.
To prevent future issues being raised about the pattern being missing if
someone tries to print one, hide everything.
2024-08-04 18:40:27 -04:00
Feoramund
6252712363
Add missing features to regex package documentation
2024-08-04 13:21:13 -04:00
Feoramund
90f1f7fbdf
Use unaligned_store in regex too
2024-07-24 16:48:49 -04:00
Feoramund
ff492e615c
Use unaligned_load for regex virtual machine
...
This should hopefully avoid any issues with loading operands greater
than 8 bits on alignment-sensitive platforms.
2024-07-24 16:27:20 -04:00
Feoramund
042f6de478
Remove printing facilities for Regular_Expression
...
The `original_pattern` introduced a tenuous dependency to the expression
value as a whole, and after some consideration, I decided that it would
be better for the developer to manage their own pattern strings.
In the event you need to print the text representation of a pattern,
it's usually better that you manage the memory of it as well.
2024-07-24 16:27:20 -04:00
Feoramund
c52a8a5f86
Allow configuring of MAX_CAPTURE_GROUPS for n > 10
2024-07-24 16:27:08 -04:00
Feoramund
16b644ad79
Use slice.zero instead
2024-07-24 15:23:20 -04:00
Feoramund
e642be8550
Fix handling of unclosed regex classes and repetitions
2024-07-24 15:17:37 -04:00
Feoramund
cb0704d51c
Add core:text/regex
2024-07-22 14:25:12 -04:00