This commit is contained in:
2025-11-25 18:38:21 +01:00
parent 769c88adc8
commit 9fe669c5b8
4 changed files with 56 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ mut cl := hetznermanager.get()!
// println('test cache, first time slow then fast')
// }
// println(cl.servers_list()!)
println(cl.servers_list()!)
// mut serverinfo := cl.server_info_get(name: 'kristof2')!

View File

@@ -104,7 +104,7 @@ Parser handles variations:
```
===FILE:name.txt=== // Standard
= = FILE : name.txt = = // Extra spaces
== FILE : name.txt ==
===file:name.txt=== // Lowercase
==FILE:name.txt== // Different = count
```
@@ -125,8 +125,7 @@ if fm.errors.len > 0 {
## Ignore Patterns
- Respects `.gitignore` and `.heroignore` in any directory
- Patterns are scoped to the directory that contains them
- Respects `.gitignore` and `.heroignore` in any parent directory
- Default patterns include `.git/`, `node_modules/`, `*.pyc`, etc.
- Use `/` suffix for directory patterns: `dist/`
- Use `*` for wildcards: `*.log`

View File

@@ -79,7 +79,7 @@ pub fn (mut path Path) list(args_ ListArgs) !PathList {
}
@[params]
pub struct ListArgsInternal {
struct ListArgsInternal {
mut:
matcher regext.Matcher
recursive bool = true

View File

@@ -49,6 +49,58 @@ pattern5 := regext.wildcard_to_regex("*test*file*")
// Result: ".*test.*file.*"
```
## Regex Group Finders
### find_sid
Extracts unique `sid` values from a given text. A `sid` is identified by the pattern `sid:XXXXXX`, where `XXXXXX` can be alphanumeric characters.
```v
import incubaid.herolib.core.texttools.regext
text := `
!!action.something sid:aa733
sid:aa733
...sid:aa733 ss
...sid:rrrrrr ss
sid:997
sid:s d
sid:s_d
`
r := regext.find_sid(text)
// Result: ['aa733', 'aa733', 'aa733', '997']
```
### find_simple_vars
Extracts simple variable names enclosed in curly braces, e.g., `{var_name}`, from a given text. Variable names can contain letters, numbers, and underscores.
```v
import incubaid.herolib.core.texttools.regext
text := `
!!action.something {sid}
sid:aa733
{a}
...sid:rrrrrr ss {a_sdsdsdsd_e__f_g}
sid:997
sid:s d
sid:s_d
`
r := regext.find_simple_vars(text)
// Result: ['sid', 'a', 'a_sdsdsdsd_e__f_g']
```
## regex replacer
Tool to flexibly replace elements in file(s) or text.