Regular expressions used in Archivarix CMS

Published: 2020-02-05

This article describes regular expressions used to search and replace content in websites restored using the Archivarix System. They are not unique to this system. If you know the regular expressions of PHP, Perl, Java or other programming languages, then you already know how to use our search and replace.

Regular expressions are a formal language for finding and manipulating substrings in text, based on the use of metacharacters. For searching, a template is used consisting of characters and metacharacters and defining a search rule. For text manipulation, an additional replacement string is also specified, which may also contain special characters.

Here is the online regular expression constructor, which allows you to create and test regular expressions using a simple interface - https://regexr.com/

The list of regular expressions used:

[abc] A single character: a, b or c
[^ abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
$ End of line
\ A Start of string
\ z End of string
. Any single character
\ s Any whitespace character
\ S Any non-whitespace character
\ d Any digit
\ D Any non-digit
\ w Any word character (letter, number, underscore)
\ W Any non-word character
\ b Any word boundary character
(...) Capture everything enclosed
(a | b) a or b
a? Zero or one of a
a * Zero or more of a
a + One or more of a
a {3} Exactly 3 of a
a {3,} 3 or more of a
a {3,6} Between 3 and 6 of a

The use of article materials is allowed only if the link to the source is posted: https://en.archivarix.com/blog/regex/

Latest news:
2020.02.14
New Friday, new updates!
A lot of new and useful was done in Archivarix CMS:
- In Search and Replace, you can now filter by url date.
- Now external links from all pages of the site can be deleted with the click of a button. Anchors are preserved.
- The new ACMS_SAFE_MODE parameter, which prohibits changing the Loader / CMS settings and loading custom files, is also prohibited from importing import settings and custom files.
- The JSON settings files for the Loader and CMS can now be downloaded to your computer and downloaded to the CMS from a file on the computer. Thus, the transfer of settings to other sites has become even easier.
- Creating custom rules has become more convenient, there are often used patterns that you can choose.
- New custom files can be created in the file manager without having to download the file.
- The url tree for the main domain always comes first.
- If you hide the url tree for the domain / subdomain, then this setting is saved while working with the CMS.
- Instead of two buttons, open / collapse the url tree, now one that can do both.
- Creating a new URL was simplified and when creating, you can immediately specify the file from the computer.
- In the mobile layout, the main working part comes first.
- After each manipulation of the file, its size is updated in the database.
- Fixed buttons for selective history rollbacks.
- Fixed creating new urls for subdomains that contain numbers in the domain name.
2020.02.07
New portion of updates!
There is no need to change anything in the source code of the files.
- Now you can upload sites to the server by uploading to the server only one script from our Archivarix CMS.
- In order to change something in the CMS settings, you no longer need to open its source code. You can set a password or lower limits directly from the Settings section.
- To connect your counters, trackers, custom scripts, a separate "includes" folder is now used inside the .content.xxxxxx folder. You can also upload custom files directly through the new file manager in CMS. Adding counters and analytics to all pages of the site has also become convenient and understandable.
- Imports support a new file structure with settings and the "includes" folder.
- Added keyboard shortcuts for working in the code editor.

These and many other improvements in the new version. The loader has also been updated and works with the settings that the CMS creates.
2020.01.23
Another mega-update of Archivarix CMS!

Added very useful tools that allow the click of a button:
- clean all broken internal links,
- delete missing images,
- set rel = "nofollow" for all external links.

Now additional restores can be imported directly from the CMS itself. You can combine different restores into one working site.

For those who work with large sites or use poor hosting - all actions that previously could stop at the timeout of your hosting will now be divided into parts and automatically continue until they are completed. Want to make a replacement in the code of 500 thousand files? Import several gigabyte recovery? All this is now possible on any, even very cheap hosting. The timeout time (by default, 30 seconds) can be changed in the ACMS_TIMEOUT parameter.

Our loader (index.php) now works on both http and https protocols, regardless of the build parameters. You can force the protocol by changing the value of the ARCHIVARIX_PROTOCOL parameter.
2020.01.07
The next update of Archivarix CMS with the addition of new features. Now any old site can be correctly converted to UTF-8 with the click of a button. Search filtering has become even better, because results can be also filtered by MIME type.
2019.12.20
We have released the long-awaited Archivarix CMS update. In the new version, in addition to various improvements and optimizations, a very useful feature has been added for additional filtering of search results and full support for the tree structure of URLs for recoveries with a large number of files. For more details, see the Archivarix CMS script change log.