Y
Y
Yuri Gulyaev2018-04-07 01:36:42
Laravel
Yuri Gulyaev, 2018-04-07 01:36:42

Why does a site on Laravel 5.5.40 not accept tags and META Keywords in Russian when publishing a post?

There is a project for starter site here https://github.com/bestmomo/laravel5-5-example
I installed it. If you add a new post from the admin panel and use tags and META Keywords in English, then the post is published normally. If you write tags and META Keywords in Russian, then the input fields for these data turn red and at the bottom there is such an inscription

Tags, separated by commas (no spaces), should have a maximum of 50 characters.
and such
Keywords, separated by commas (no spaces), should have a maximum of 50 characters.

I believe that validation fails in this file...
https://github.com/bestmomo/laravel5-5-example/blo...
Namely, in this line here:
$regex = '/^[A-Za-z0-9-éèàù]{1,50}?(,[A-Za-z0-9-éèàù]{1,50})*$/';

I made the line look like this:
$regex = '/^[A-Za-z0-9-А-Яа-я0-9]{1,50}?(,[A-Za-z0-9-А-Яа-я0-9]{1,50})*$/';

But this did not affect the result in any way. I understand that I probably need to change something in other files as well... Maybe I also incorrectly added our characters to the regular expression...
Please help me solve the problem with Russian tags and keywords. I ask you not to kick much, laravel has recently started to study. And yet, bright heads, tell me what these symbols can mean in this expression
éiau

Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iljaGolubev, 2018-04-09
@yuri25

Try
$regex = '/^[A-Za-z0-9-A-Za-z0-9]{1,50}?(,[A-Za-z0-9-A-Za-z0-9]{ 1.50})*$/ u ';
docs.php.net/manual/en/intro.mbstring.php

Y
Yan-s, 2018-04-07
@Yan-s

Make sure that it's a regular expression (try to remove it altogether), rewrite it in an editor with regular expression support so that you understand what's going on in it and where the problem is.
For example, in this piece
[A-Za-z0-9-A-Yaa-z0-9]
0-9 is repeated twice, after the first 0-9 there is an extra hyphen.
[A-Za-z0-9A-Zaa-z]
Maybe this will help, but you still need to understand what is happening in the expression.
The characters you specified (éèàù) are simply listed as valid.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question