mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,4 Tsd.
aktive Profile

#regexp

0 Beiträge0 Beteiligte0 Beiträge heute

Mikäs helvetin bait and switch tämä on?
Firefoxin js-konsoli "ennustaa" etukäteen, että testin tulos on `true` (mikä on oikein), mutta kun sen suorittaa, tulos onkin `false`.

Node antaa tulokseksi `true`. Samoin Chromiumin konsoli.

Itse asiassa, kun "ennustusta" pyytää uudelleen ja uudelleen, se antaa vuorotellen `true` ja `false`. Ja suorituksen vastaus riippuu siitä, kumpi ennustus on ollut viimeisimpänä.

Eli: Firefoxin konsolissa RegExpin test() ei ole luotettava.
#javascript #regexp

Just going through the logs of my own mail server (Thanks, @mwl !) to extend my #postfix #fail2ban #regexp to ban hosts with too many unsuccesful login attempts. Knowing the user name pattern (example.com only letters, others with at least one dot) I came up with

'warning: .*\[<HOST>\]: SASL LOGIN authentication failed: .*sasl_username=<F-USER>(?:[^.]*@(?!example\.com)|[^.]*\.[^.]*@(?:example\.com))</F-USER>'

This works great.

New at PragProg

Staffan Nöteberg helps you really understand how the machinery works under the hood. Learn advanced tools like reluctant, lookbehind and nondeterministic finite automata to write efficient and elegant regexes with ease.

In this illustrated guide, you gain precisely that understanding., even with no prior knowledge of Regular Expressions.

pragprog.com/titles/d-snrem

@staffannoteberg

#RegExp experts:

Is there a way to have a single regex and a single replacement string for a masking task like this w/o looping or multiple function calls?

johndoe@example.com
?????*+@?????*+.?+
johnd**@examp**.com

1. 1st n chars unmasked
2. Remaining chars until fixed chars masked
3. Fixed chars as is
4. 1st n chars unmasked
5. Remaining chars until fixed chars masked
6. Fixed chars as is
7. Remainder unmasked

The agrep() function in base R enables approximate string matching (fuzzy matching), useful for tasks like correcting misspellings and finding similar strings.

Its syntax includes parameters for the search pattern, target vector, maximum distance for matches, case sensitivity, and output format.

By default, it returns indices of matches, but setting `value = TRUE` returns the matched elements.

Post: spsanderson.com/steveondata/po

#R#RStats#Programming