C
C
Creel2015-10-31 17:19:01
Regular Expressions
Creel, 2015-10-31 17:19:01

How to make a complex regular expression with logic?

Help me compose a regular expression for the script https://jsfiddle.net/mavj2kdr/
it is necessary to replace it differently if the character is present

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-11-02
@ShamblerR

will it go through .htaccess?
there will be 3 lines

RewriteCond %{HTTP_HOST} ^www\.www\.ru [NC]
RewriteCond %{REQUEST_URI} /users\.php$ [NC]
RewriteCond %{QUERY_STRING} !role=shop_manager [NC]
RewriteRule ^(.*)$ Куда_нужно_но_тут_с_гет_запросом [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.users\.php [NC]
RewriteCond %{QUERY_STRING} role=shop_manager [NC]
RewriteRule ^(.*)$ http://www.www.ru/users.php [R=301,L]

Accordingly, all these variables and the regular expressions themselves will be the same in php, but I’m not strong in pregmatch, so you are already getting more expensive, in principle, it will work even through .htaccess, but the redirect to GET does not work well in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question