Code syntax

From Opera Wiki

(Difference between revisions)
Jump to: navigation, search
(Some basic concepts)
 
(2 intermediate revisions not shown)
Line 1: Line 1:
-
{{WIP}}
+
 
-
{{BR}}
+
{{NB|The syntax function codes was created with the purpose of creating limitations or, more generally, rules to be used on the names of the articles in the archive. These rules can be used for example to force the use of a minimum or maximum number of characters, a subset of characters, or to prohibit others.}}
{{NB|The syntax function codes was created with the purpose of creating limitations or, more generally, rules to be used on the names of the articles in the archive. These rules can be used for example to force the use of a minimum or maximum number of characters, a subset of characters, or to prohibit others.}}

Latest revision as of 12:58, 7 September 2023


Note N.B: The syntax function codes was created with the purpose of creating limitations or, more generally, rules to be used on the names of the articles in the archive. These rules can be used for example to force the use of a minimum or maximum number of characters, a subset of characters, or to prohibit others.


Contents


Some basic concepts

Creating a syntax rule requires a basic knowledge of regular expressions: a regular expression is a sequence of symbols that identifies a set of strings. Each symbol has a well-defined meaning, for example:

  • the symbol ^: identifies the beginning of the string
  • the symbol *: quantifier (between 0 and n times)
  • [a-z]: identifies lower case letters between a and z
  • [0-9] identifies numbers between 0 and 9
  • $ identifies the end of tne string


An example of a regular expression could therefore be: ^60TT-[a-z]*-ALL$ which identifies all the strings that begin with the characters 60TT-, have any number of lower case letters and end with the substring -ALL

Given the breadth of the topic, this chapter will not cover all the rules and syntax of regular expressions, but please refer to the online bibliography for further details.

Content description

The window of codes Syntax


  • Type/System/Series: Filter fields to identify the system, series and type of article to which the code has been applied.
  • Test: field for the verification and filtering of codes associated with articles.
  • Name: syntax name.
  • Desc: syntax description.
  • Type/System/Series File:tastomenutendina.png: fields for choosing the system, series and type of article to which the syntax should be matched.
  • Syntax: field for recording the regular expression.
  • Enforce syntax:If enabled, it does not allow recording of the expression if the syntax is not respected.
  • Test: fields to test the validity of the syntax.



How to create a code syntax

However, let’s try using this regular expression as an example to create a code syntax in the program:

  • Open the file and create a new entry by assigning a name and a description.
  • We choose which type of code this rule will apply to by choosing it from the list.
  • Let’s write in the syntax field the rule chosen, for example abcde or 60TT-123-ALL.

We then activate the field Enforce syntax to ensure that the program prohibits the recording of the entry in the archive if the syntax rule is not respected.

As you can see, the section below provides a series of fields where you can test the syntax on strings at will.

If the string does not pass the verification of conformity, an error symbol will appear next to the text; conversely, a confirmation symbol will appear.

Use in the program

  • In the profile archive, create a new profile for the selected system and series under 'Code syntax', and paste the text abcde in the Name field
  • The program does not allow you to save the new profile because the code entered is not compliant.

If, instead, we use the code 60TT-abcd-ALL, the new profile can be registered.

Example of wrong code Example of correct code
Personal tools