Nouveau post :
L'essentiel sur les expressions régulières en JavaScript
https://kalvn.net/blog/l-essentiel-sur-les-expressions-regulieres-en-javascript/
Nouveau post :
L'essentiel sur les expressions régulières en JavaScript
https://kalvn.net/blog/l-essentiel-sur-les-expressions-regulieres-en-javascript/
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.
#TFW #regexp в 6 строчек, написанный #ChatGPT, парсит #Markdown более лучше ①, чем тысячи строк #Redcarpet ② под капотом у #GlitchSoc
Un outil de remplacement de texte qui semble avoir une ergonomie un peu plus confortable que sed https://github.com/c0stya/trre #commandline #regexp #opensource
The {rematch2} #RStats is a “small wrapper on regular expression matching functions regexpr and gregexpr to return the results in tidy data frames.” By @gaborcsardi . On CRAN.
https://github.com/r-lib/rematch2#readme
#RegExp #RegEx
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.
Another resource for regular expressions in R: A Shiny app by Adam Spannbauer
App: https://spannbaueradam.shinyapps.io/r_regex_tester/
Blog post: https://adamspannbauer.github.io/2018/01/16/r-regex-tester-shiny-app/
Need help with regular expressions in R? Check out the RegExplain RStudio add-in by @grrrck
https://www.garrickadenbuie.com/project/regexplain/
https://gugod.org/2024/11/regexp-digits/
如果你在用正規表示式的 \d 在驗證來自使用者的輸入的話,你得再想想。
A website to write, test, and share regular expressions!
(I think this is pretty well-known, actually...)Updated version of my ideas for improving the JavaScript RegExp API: https://gist.github.com/rauschma/8db338a96f9ead8df0714d233e81fed4
@tripleo You’re thinking of #Perl’s “taint mode” (stop your teenage giggling), where outside data is untrusted unless it’s the extracted subpattern match in a #RegularExpression.
It’s only enabled under certain conditions. Read about it in the `perlsec` manual page: https://perldoc.perl.org/perlsec#Taint-mode
I see a lot of unnecessarily specific regexs (typically excessive captures & pointless `.*$`) being used. Logic says they'll be slower so I spent about 90 seconds testing an example on 3 in-browser JS benchmark apps.
Comparing:
`/^(Hello), this is a string (.*)$/` to
`/^Hello, this is a string /`
the latter is 1.5-5x faster on all 3 apps.
#RegEx #RegExp #RegularExpression
Une idée incroyable : au lieu d'interpréter le pattern d'une expression régulière à l'exécution, cette librairie crée une classe Java exécutant le pattern au moment du build. Ca optimise considérablement l'exécution du code, évidement. Par contre, je ne vois pas (encore) comment intégrer ça dans un projet "classique" : pas de plugin maven ou de configuration de compilateur. Il y a donc … https://github.com/hyperpape/needle #java #regexp #library #optimisation #compilation #opensource
Une belle histoire d'expression régulière sur un sujet en apparence simple, mais aux conséquences désastreuses pour les performances. Ce qui est drôle, c'est que la bonne solution, c'est peut-être bien de passer par un parser XML qui éliminera correctement les commentaires. https://regexide.com/ #javascript #regexp #performance #algorithme #design
Useful #beginner #VIM #substitution #regexp #pattern for today:
I needed to add markdown to plaintext reference pattern e.g. "(photo 1)" .
~~~
%s/(\(photo [0-9]*\))/\*\0\*/g
~~~
and for any pattern that matches "(word Nchar)" e.g.: (figure 3c)
:%s/(\(\a* [0-9]*\a\))/\*\0\*/g
Also, I kept failing, because \a[0-9]* instead of [0-9]*\a . Which wasn't even intended, just a typo. (Pun not intended neither) :D
To my fellow #ActuallyAutistics who are also into programming. Can you handle #RegEx / #RegExp?
Up to how much complexity?
When I was younger, it was easy. Today, I have to use a test tool! ^_^;;
#Autistics #Autism #ActuallyAutistic #Autistic #AutismSpectrum #AskingAutistics