Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

r"
"
gm

Test String

Code Generator

Generated Code

const regex = new RegExp('^map\\s*\\$\\w+\\s*\\$\\w+\\s*{\\n*\\s*([a-z,.]+)\\s*([a-z,_]+);\\s*', 'gm') const str = `# configuration file /etc/nginx/nginx.conf: user www-data; worker_processes auto; pid /var/run/nginx.pid; load_module modules/ngx_http_wallarm_module.so; include /etc/nginx/modules-enabled/*.conf; worker_rlimit_nofile 65535; events { worker_connections 8096; multi_accept on; use epoll; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; include /etc/nginx/mime.types; default_type application/octet-stream; geoip_country /usr/share/GeoIP/GeoIP.dat; # Lua lua_package_path '/etc/nginx/lua/?.lua;;'; lua_package_cpath '/etc/nginx/lua/lib/?.so;;'; lua_shared_dict stats 10m; map \$http_user_agent \$log_ua { ^Wallarm.* 0; default 1; } map \$http_upgrade \$connection_upgrade { default upgrade; '' close; } error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; client_max_body_size 100m; log_format wallarm_combined '\$remote_addr | \$host | "\$request" | \$status | \$body_bytes_sent | "\$http_referer" | "\$http_user_agent" | \$wallarm_attack_type'; log_format qrator '2xFFFFFF|:,_|\$bytes_sent|:,_|\$http_accept|:,_|\$http_accept_encoding|:,_|\$http_accept_language|:,_|\$http_cookie|:,_|\$http_host|:,_|\$http_referer|:,_|\$http_user_agent|:,_|\$http_x_forwarded_for|:,_|\$remote_addr|:,_|\$request|:,_|\$request_time|:,_|\$status|:,_|\$time_local|:,_|\$upstream_response_time|:,_|\$http_x_requested_with|:,_|\$http_authorization|:,_|\$remote_port|:,_|-|:,_|\$msec|:,_|'; more_clear_headers Server; proxy_headers_hash_bucket_size 128; log_format main '\$remote_addr - \$remote_user [\$time_local] ' '"\$host" "\$request" \$status \$body_bytes_sent ' '"\$http_referer" "\$http_user_agent"'; access_log syslog:server=127.0.0.1:20001 main; error_log syslog:server=127.0.0.1:20002; include /etc/nginx/qrator_real_ip.conf; include /etc/nginx/whites.conf; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } # configuration file /etc/nginx/modules-enabled/10-mod-http-ndk.conf: load_module modules/ndk_http_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-auth-pam.conf: load_module modules/ngx_http_auth_pam_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-dav-ext.conf: load_module modules/ngx_http_dav_ext_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-echo.conf: load_module modules/ngx_http_echo_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-geoip.conf: load_module modules/ngx_http_geoip_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-headers-more-filter.conf: load_module modules/ngx_http_headers_more_filter_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-image-filter.conf: load_module modules/ngx_http_image_filter_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-lua.conf: load_module modules/ngx_http_lua_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-subs-filter.conf: load_module modules/ngx_http_subs_filter_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-upstream-fair.conf: load_module modules/ngx_http_upstream_fair_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-http-xslt-filter.conf: load_module modules/ngx_http_xslt_filter_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-mail.conf: load_module modules/ngx_mail_module.so; # configuration file /etc/nginx/modules-enabled/50-mod-stream.conf: load_module modules/ngx_stream_module.so; # configuration file /etc/nginx/mime.types: types { text/html html htm shtml; text/css css; text/xml xml rss; image/gif gif; image/jpeg jpeg jpg; application/x-javascript js; application/atom+xml atom; text/mathml mml; text/plain txt; text/vnd.sun.j2me.app-descriptor jad; text/vnd.wap.wml wml; text/x-component htc; image/png png; image/tiff tif tiff; image/vnd.wap.wbmp wbmp; image/x-icon ico; image/x-jng jng; image/x-ms-bmp bmp; image/svg+xml svg svgz; application/java-archive jar war ear; application/json json; application/mac-binhex40 hqx; application/msword doc; application/pdf pdf; application/postscript ps eps ai; application/rtf rtf; application/vnd.ms-excel xls; application/vnd.ms-powerpoint ppt; application/vnd.wap.wmlc wmlc; application/vnd.google-earth.kml+xml kml; application/vnd.google-earth.kmz kmz; application/x-7z-compressed 7z; application/x-cocoa cco; application/x-java-archive-diff jardiff; application/x-java-jnlp-file jnlp; application/x-makeself run; application/x-perl pl pm; application/x-pilot prc pdb; application/x-rar-compressed rar; application/x-redhat-package-manager rpm; application/x-sea sea; application/x-shockwave-flash swf; application/x-stuffit sit; application/x-tcl tcl tk; application/x-x509-ca-cert der pem crt; application/x-xpinstall xpi; application/xhtml+xml xhtml; application/zip zip; application/octet-stream bin exe dll; application/octet-stream deb; application/octet-stream dmg; application/octet-stream eot; application/octet-stream iso img; application/octet-stream msi msp msm; application/ogg ogx; audio/midi mid midi kar; audio/mpeg mpga mpega mp2 mp3 m4a; audio/ogg oga ogg spx; audio/x-realaudio ra; audio/webm weba; video/3gpp 3gpp 3gp; video/mp4 mp4; video/mpeg mpeg mpg mpe; video/ogg ogv; video/quicktime mov; video/webm webm; video/x-flv flv; video/x-mng mng; video/x-ms-asf asx asf; video/x-ms-wmv wmv; video/x-msvideo avi; } # configuration file /etc/nginx/qrator_real_ip.conf: set_real_ip_from 87.245.197.192; set_real_ip_from 87.245.197.193; set_real_ip_from 87.245.197.194; set_real_ip_from 87.245.197.195; set_real_ip_from 87.245.197.196; set_real_ip_from 83.234.15.112; set_real_ip_from 83.234.15.113; set_real_ip_from 83.234.15.114; set_real_ip_from 83.234.15.115; set_real_ip_from 83.234.15.116; set_real_ip_from 66.110.32.128; set_real_ip_from 66.110.32.129; set_real_ip_from 66.110.32.130; set_real_ip_from 66.110.32.131; set_real_ip_from 130.117.190.16; set_real_ip_from 130.117.190.17; set_real_ip_from 130.117.190.18; set_real_ip_from 130.117.190.19; set_real_ip_from 185.94.108.0/24; set_real_ip_from 10.3.52.32/27; real_ip_header X-Qrator-IP-Source; real_ip_recursive on; # configuration file /etc/nginx/whites.conf: geo \$exampleapp { 192.168.100.100 off; default monitoring; } geo \$sberauto { default monitoring; } geo \$thehrp { default monitoring; } geo \$kfc { default monitoring; } geo \$kfc_block { default block; } # configuration file /etc/nginx/conf.d/default.conf: server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \\.php\$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \\.php\$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts\$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\\.ht { # deny all; #} } # configuration file /etc/nginx/conf.d/wallarm-acl.conf: wallarm_acl_db cyberpolygon { wallarm_acl_path /var/lib/wallarm/wallarm_acl-cyberpolygon; wallarm_acl_mapsize 64m; } server { listen 127.0.0.10:80; server_name localhost; allow 127.0.0.0/8; deny all; access_log off; location /wallarm-acl { wallarm_acl cyberpolygon; wallarm_acl_api on; } } # configuration file /etc/nginx/conf.d/wallarm-status.conf: # wallarm-status, required for monitoring purposes. server { listen 127.0.0.8:80; server_name localhost; allow 127.0.0.0/8; allow 10.2.67.67/32; deny all; wallarm_mode off; access_log off; location /wallarm-status { wallarm_status on; access_log /tmp/test; } } # configuration file /etc/nginx/conf.d/wallarm.conf: # # Wallarm module specific parameters # wallarm_mode monitoring; wallarm_mode_allow_override off; # wallarm_key_path /etc/wallarm/license.key; # wallarm_global_trainingset_path /etc/wallarm/proton.db; # wallarm_local_trainingset_path /etc/wallarm/lom; wallarm_fallback on; wallarm_acl_db default { wallarm_acl_path /var/lib/nginx/wallarm_acl_default; wallarm_acl_mapsize 64m; } # wallarm_cache_path /var/cache/nginx/wallarm # wallarm_instance -1; #wallarm_block_page @error; error_page 400 @error; error_page 403 @error; error_page 302 @error; error_page 301 @error; error_page 502 @error; error_page 500 @error; # wallarm_parse_response on; # wallarm_parse_websocket off; # wallarm_process_time_limit 1000; # wallarm_process_time_limit_block attack; # wallarm_worker_rlimit_vmem 1g; # wallarm_tarantool_host 127.0.0.1; # wallarm_tarantool_port 3313; #upstream wallarm_tarantool { # server 10.2.67.28:3313 max_fails=0 fail_timeout=0 max_conns=1; # keepalive 1; # } #wallarm_tarantool_upstream wallarm_tarantool; # wallarm_upstream_connect_attempts 10; # wallarm_upstream_reconnect_interval 15; # configuration file /etc/nginx/sites-enabled/check: server { listen 80; server_name check; include error.conf; allow 10.3.52.32/27; deny all; return 200; } # configuration file /etc/nginx/error.conf: location @error { root /etc/nginx/html/; if (\$request_method != 'GET') { return 403 '<pre>Access denied</pre>'; } internal; try_files /\$status.html =403; } # configuration file /etc/nginx/sites-enabled/collect_statistics: upstream node_01 { server 10.2.53.2:80 max_fails=10 fail_timeout=30; } upstream node_02 { server 10.3.52.3:80 max_fails=10 fail_timeout=30; } server { listen 80; listen 443 ssl; server_name stat1.mow03.cwaf.zone; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; include ssl.conf; include error.conf; location /node01 { proxy_pass http://node_01; } location /node02 { access_by_lua_file /etc/nginx/lua/show.lua; } } # configuration file /etc/nginx/ssl.conf: ssl_session_cache shared:le_nginx_SSL:1m; ssl_session_timeout 1440m; ssl_prefer_server_ciphers on; ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS"; ssl_dhparam /etc/nginx/ssl-dhparams.pem; # configuration file /etc/nginx/sites-enabled/cyberpolygon.com: upstream cyberpolygon_testbizone { server 10.3.90.10:80 max_fails=0 fail_timeout=180; keepalive 1000; } upstream cyberpolygon_testbizone_ws { server 10.3.90.10:4443 max_fails=0 fail_timeout=180; keepalive 1000; } upstream cyberpolygon_hatest { #ip_hash; hash \$remote_addr\$remote_port; server 10.3.90.2:8080 max_fails=0 fail_timeout=180; server 10.3.90.3:8080 max_fails=0 fail_timeout=180; keepalive 100; } upstream cyberpolygon_hatest_ws { ip_hash; server 10.3.90.11:4443 max_fails=0 fail_timeout=180; keepalive 100; } server { listen 80; server_name hatest.cyberpolygon.com; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; location / { proxy_pass http://cyberpolygon_hatest; include proxy.conf; } # Disable static files check location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass http://cyberpolygon_hatest; include proxy.conf; } } server { listen 80; server_name cyberpolygon.com; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; proxy_connect_timeout 300; proxy_read_timeout 300; proxy_send_timeout 180; #rewrite ^([^.]*[^/])\$ \$1/ permanent; access_log syslog:server=10.3.78.23:514,facility=local7,tag=cwaf,severity=info wallarm_combined if=\$wallarm_attack_type; access_log syslog:server=127.0.0.1:20001 main; deny 109.252.53.206; allow all; location / { proxy_pass http://cyberpolygon_hatest; include proxy.conf; } #location /testblacklist_cwaf { # proxy_pass http://cyberpolygon_hatest; # wallarm_acl cyberpolygon; # include proxy.conf; #} # Disable static files check location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass http://cyberpolygon_hatest; include proxy.conf; } } server { listen 4443 default_server; server_name _; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; proxy_connect_timeout 60; proxy_read_timeout 1d; proxy_send_timeout 1d; location / { proxy_pass http://cyberpolygon_hatest_ws; proxy_set_header Host \$host; proxy_http_version 1.1; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection "upgrade"; } } server { listen 4443; server_name hatest.cyberpolygon.com; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; proxy_connect_timeout 60; proxy_read_timeout 1d; proxy_send_timeout 1d; location / { proxy_pass http://cyberpolygon_hatest_ws; proxy_set_header Host \$host; proxy_http_version 1.1; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection "upgrade"; } } server { listen 4444; server_name hatest.cyberpolygon.com; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; proxy_connect_timeout 60; proxy_read_timeout 1d; proxy_send_timeout 1d; location / { proxy_pass http://cyberpolygon_hatest_ws; proxy_set_header Host \$host; proxy_http_version 1.1; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection "upgrade"; } } server { listen 80; server_name cyberpolygon.testbizone.ru; set \$wallarm_instance 57401; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter include qrator_real_ip.conf; location / { proxy_pass http://cyberpolygon_testbizone; proxy_set_header Host 'fake.jq.lv'; include proxy.conf; } # Disable static files check location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass http://cyberpolygon_testbizone; include proxy.conf; } } # configuration file /etc/nginx/count.conf: log_by_lua_file /etc/nginx/lua/count.lua; # configuration file /etc/nginx/proxy.conf: proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_http_version 1.1; proxy_set_header Connection ""; # configuration file /etc/nginx/sites-enabled/default: server { listen 443 ssl default_server; server_name _; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; ssl_protocols TLSv1.1 TLSv1.2; include error.conf; return 444; } server { listen 80 default_server; server_name _; include error.conf; return 444; } server { listen 80; server_name status; allow 127.0.0.1; deny all; location /nginx_status { stub_status; } } # configuration file /etc/nginx/sites-enabled/fake.jq.lv: upstream exampleapp { ip_hash; server fake.jq.lv:443; } server { listen 80; server_name fake.jq.lv; set \$wallarm_instance 51781; # Replace with valid instance number wallarm_instance \$wallarm_instance; wallarm_mode \$exampleapp; # check whites.conf for geoip whitelist or specify mode manually wallarm_mode_allow_override off; include error.conf; # Custom error pages include count.conf; # Lua counter access_log syslog:server=127.0.0.1:10001 qrator; location / { proxy_pass https://exampleapp; include proxy.conf; } # Disable static files check location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass https://exampleapp; include proxy.conf; } } # configuration file /etc/nginx/sites-enabled/kfc.ru: upstream kfc_ru { server 95.131.26.22:443 max_fails=10 fail_timeout=30; keepalive 32; } upstream stg_kfc_ru { server 85.193.75.86:443 max_fails=10 fail_timeout=30; keepalive 32; } upstream kfc_az_com { server 185.99.9.23:443 max_fails=10 fail_timeout=30; keepalive 32; } upstream gsd_kfc_ru { server 95.181.206.171:443 max_fails=10 fail_timeout=30; keepalive 32; } #upstream gsd_kfc_ru_http { # server 95.181.206.171:80 max_fails=10 fail_timeout=30; # keepalive 32; #} map \$http_host \$kfc_upstream { kfc.ru kfc_ru; staging.website.kfc.digital stg_kfc_ru; staging.kfc.digital stg_kfc_ru; gsd.kfc.ru gsd_kfc_ru; fz.kfc.ru gsd_kfc_ru; mgsd.kfc.ru gsd_kfc_ru; www.kfc.by kfc_az_com; kfc.by kfc_az_com; www.m.kfc.by kfc_az_com; m.kfc.by kfc_az_com; in.kfc.by kfc_az_com; m.in.kfc.by kfc_az_com; admin.kfc.by kfc_az_com; www.kfc-az.com kfc_az_com; kfc-az.com kfc_az_com; www.m.kfc-az.com kfc_az_com; m.kfc-az.com kfc_az_com; in.kfc-az.com kfc_az_com; m.in.kfc-az.com kfc_az_com; admin.kfc-az.com kfc_az_com; feedback.kfc.ru kfc_az_com; default kfc_ru; } map \$http_host \$kfc_wallarm_instance { kfc.ru 68381; staging.website.kfc.digital 68382; staging.kfc.digital 68382; gsd.kfc.ru 68383; fz.kfc.ru 68384; mgsd.kfc.ru 68385; www.kfc.by 68386; kfc.by 68386; www.m.kfc.by 68388; m.kfc.by 68388; in.kfc.by 683810; m.in.kfc.by 683811; admin.kfc.by 683812; www.kfc-az.com 683813; kfc-az.com 683813; www.m.kfc-az.com 683815; m.kfc-az.com 683815; in.kfc-az.com 683817; m.in.kfc-az.com 683818; admin.kfc-az.com 683819; feedback.kfc.ru 683820; default 68381; } server { listen 80; server_name *.kfc.by *.kfc.ru *.kfc-az.com staging.kfc.digital; set \$wallarm_instance \$kfc_wallarm_instance; wallarm_instance \$wallarm_instance; wallarm_mode \$kfc; wallarm_mode_allow_override off; proxy_ssl_server_name on; proxy_ssl_name \$host; include ssl.conf; include error.conf; include count.conf; set_real_ip_from 10.3.52.32/27; real_ip_header X-Real-IP; real_ip_recursive on; ssl_session_tickets on; location / { wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /fz/Telerik.Web.UI.WebResource.axd { wallarm_process_time_limit 10000; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /svc/Telerik.Web.UI.WebResource.axd { wallarm_process_time_limit 10000; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /bp { proxy_read_timeout 20m; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_ssl_protocols TLSv1.2; proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } # location /testtest { # wallarm_parse_response off; # proxy_pass http://gsd_kfc_ru_http; # include proxy.conf; # } location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; } location /api/mqtt/ws { proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection \$connection_upgrade; } } server { listen 80; #server_name kfc.ru kfc-az.com kfc.by *.kfc.by *.kfc.ru *.kfc-az.com staging.website.kfc.digital staging.kfc.digital; server_name www.kfc.by kfc.by www.m.kfc.by m.kfc.by in.kfc.by m.in.kfc.by admin.kfc.by www.kfc-az.com kfc-az.com www.m.kfc-az.com m.kfc-az.com in.kfc-az.com m.in.kfc-az.com admin.kfc-az.com feedback.kfc.ru mgsd.kfc.ru staging.website.kfc.digital kfc.ru www.kfc.ru fz.kfc.ru; set \$wallarm_instance \$kfc_wallarm_instance; wallarm_instance \$wallarm_instance; wallarm_mode \$kfc_block; wallarm_mode_allow_override off; wallarm_process_time_limit_block off; proxy_ssl_server_name on; proxy_ssl_name \$host; include ssl.conf; include error.conf; include count.conf; set_real_ip_from 10.3.52.32/27; real_ip_header X-Real-IP; real_ip_recursive on; ssl_session_tickets on; location / { wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /fz/Telerik.Web.UI.WebResource.axd { wallarm_process_time_limit 10000; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /svc/Telerik.Web.UI.WebResource.axd { wallarm_process_time_limit 10000; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /bp { proxy_read_timeout 20m; wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } # location /testtest { # wallarm_parse_response off; # proxy_pass http://gsd_kfc_ru_http; # include proxy.conf; # } location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass https://\$kfc_upstream; include proxy.conf; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } location /api/mqtt/ws { proxy_pass https://\$kfc_upstream; include proxy.conf; proxy_set_header Upgrade \$http_upgrade; proxy_set_header Connection \$connection_upgrade; #proxy_ssl_protocols TLSv1.2; #proxy_ssl_ciphers RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!DH:!DHE; } } # configuration file /etc/nginx/sites-enabled/sberauto.com: upstream sberauto_com { server 213.219.212.149:443 max_fails=10 fail_timeout=30; keepalive 32; } map \$http_host \$sberauto_wallarm_instance { sberauto.com 66501; www.sberauto.com 66501; api.sberauto.com 66502; files.sberauto.com 66503; images.sberauto.com 66504; default 66501; } server { listen 80; server_name www.sberauto.com sberauto.com api.sberauto.com files.sberauto.com images.sberauto.com; server_name *.sberauto.com; set \$wallarm_instance \$sberauto_wallarm_instance; wallarm_instance \$wallarm_instance; wallarm_mode \$sberauto; wallarm_mode_allow_override off; include ssl.conf; include error.conf; include count.conf; set_real_ip_from 10.3.52.32/27; real_ip_header X-Real-IP; real_ip_recursive on; # ssl_protocols TLSv1.2; location / { proxy_pass https://sberauto_com; include proxy.conf; } location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass https://sberauto_com; include proxy.conf; } } # configuration file /etc/nginx/sites-enabled/thehrp.ru: upstream thehrp { server 37.18.116.40:443 max_fails=10 fail_timeout=30; keepalive 32; } map \$http_host \$thehrp_wallarm_instance { default 68131; } server { listen 80; server_name *.thehrp.ru thehrp.ru; set \$wallarm_instance \$thehrp_wallarm_instance; wallarm_instance \$wallarm_instance; wallarm_mode \$thehrp; wallarm_mode_allow_override off; include ssl.conf; include error.conf; include count.conf; set_real_ip_from 10.3.52.32/27; real_ip_header X-Real-IP; real_ip_recursive on; location / { proxy_pass https://thehrp; include proxy.conf; } location ~* \\.(js|jpg|png|css|ico|svg|pdf|woff|eot|otf|woff2)\$ { wallarm_parse_response off; proxy_pass https://thehrp; include proxy.conf; } } `; // Reset `lastIndex` if this regex is defined globally // regex.lastIndex = 0; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } // The result can be accessed through the `m`-variable. m.forEach((match, groupIndex) => { console.log(`Found match, group ${groupIndex}: ${match}`); }); }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions