kalvn's links
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
2 results tagged hash  ✕
PHP Twitter Hashtag Validation Regex · GitHub https://gist.github.com/janogarcia/3946583
13/03/2018 15:30:20

Une regex pour valider un hashtag. Implémentation en PHP.

<?php
/**
* PHP Regex to validate a Twitter hashtag
* 
* Useful for validating a text input (an HTML form in your CMS or custom application) that must be a valid Twitter hashtag.
* Valid examples: #a, #_, #_1, #_a, #1a, #áéìôü, #123hàsh_täg446
* Invalid examples: #1, ##hashtag, #hash-tag, #hash.tag, #hash tag, #hashtag!, (any hashtag that is more than 140 characters long, hash symbol included)
* 
* Regex explanation:
* First, the lookahead assertion (?=.{2,140}$) checks the minimum and max length, as explained here http://stackoverflow.com/a/4223213/1441613
* A hash symbol must be the first character. The allowed values for the hash symbol can be expressed with any of the following subpatterns: (#|\\uff0){1}, (#|\x{ff03}){1}, or (#|#){1}.
* A hashtag can contain any UTF-8 alphanumeric character, plus the underscore symbol. That's expressed with the character class [0-9_\p{L}]*, based on http://stackoverflow.com/a/5767106/1441613
* A hashtag can't be only numeric, it must have at least one alpahanumeric character or the underscore symbol. That condition is checked by ([0-9_\p{L}]*[_\p{L}][0-9_\p{L}]*), similar to http://stackoverflow.com/a/1051998/1441613
* Finally, the modifier 'u' is added to ensure that the strings are treated as UTF-8.
*
* More info:
* https://github.com/twitter/twitter-text-conformance
* https://github.com/nojimage/twitter-text-php
* https://github.com/ngnpope/twitter-text-php
*/
preg_match('/^(?=.{2,140}$)(#|\x{ff03}){1}([0-9_\p{L}]*[_\p{L}][0-9_\p{L}]*)$/u', '#hashtag');
php regex hashtag
How to Safely Store a Password in 2016 https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016
17/02/2016 10:19:17

Comment stocker un mot de passe de manière sécurisée en 2016. Des solutions sont proposées pour les principaux langages.

password stockage hash
3869 links, including 129 private
Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community - Theme by kalvn