i want to ask, what is the meaning or difference between these two line?
if( preg_match_all('/\#([א-תÀ-ÿ一-龥а-яa-z0-9\-_]{1,50})/iu', $message, $matches, PREG_PATTERN_ORDER) ) {
if( preg_match_all('/\#([а-яa-z0-9\-_\x{4e00}-\x{9fa5}]{1,50})/iu', $message, $matches, PREG_PATTERN_ORDER) ) {
and what does the number 3 mean in this line? (Arrow pointing)
if( preg_match_all('/\@([a-zA-Z0-9\-_\x{4e00}-\x{9fa5}]{->3,30})/u', $message, $matches, PREG_PATTERN_ORDER) ) {
Thanks!
I'll answer the 2nd part of your question:
The {3,30} in the regex means quantifier for a min of 3 and a max of 30 repetitions.
a* means zero or more aa+ means one or more aa? means zero or one aa{1} means exactly one a same as
just aa{1,} means one or more a same as
a+a{1,3} means min of one and max of
3 a'syou can have any complex regex in place of a. Example: [a-zA-Z]{3,30} would mean at least 3 and at max 30 of any of the alphabets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With