from github to this gitea

This commit is contained in:
oscar.plaisant@icloud.com
2023-10-23 23:09:51 +02:00
commit a2ee0fa5ca
2898 changed files with 307871 additions and 0 deletions

36
vim regex lookaround.md Normal file
View File

@@ -0,0 +1,36 @@
---
alias: [ "vim regex lookahead", "vim regex lookbehind", "vim regex lookaround", "lookahead", "lookbehind", "lookaround" ]
---
up:: [[vim regex]]
title:: "before and after matches"
#informatique
---
Allows to match pattern after (lookahead) or before (lookbehind) the current pattern.
# Quick reference
- `\zs` starts the selection (everything before is searched for but not matched)
- `\ze` stop the selection (everything after is searched for but not matched)
| | positive | negative |
| ---------- | -------- | -------- |
| lookahead |`@=`|`@!`|
| lookbehind |`@<=`|`@<!`|
# Exemples
> [!example] president (not (Macron|Hollande))
> To match President if it is **not** `President Macron` or `President Hollande`.
> Note that the match will select only `President` (else the regex is obvious).
> `President\(Macron\|Hollande\)\@!`
> Or, with verymagic mode
> `\vPresident(Macron|Hollande)@!`
> [!example] python attributes, but not of self
> Match any python attribute (a word after a dot), except attributes of `self` (attributes of an object from the object itself)
> `\(self\)\@<!\.\zs\w\+`
> or, with verymagic mode
> `\v(self)@<!.\zs\<+`
>