Table of Contents

Class ConstantReferencePatterns

Namespace
GroupeIsa.Neos.Shared.Localization
Assembly
GroupeIsa.Neos.Shared.dll

Provides the regex patterns used to locate constant references in UI templates. Shared between the generator's dependency locators for Constant (full "ClassName.ConstantName") and ConstantsStaticClass (bare "ClassName") usage search and rename support.

public static class ConstantReferencePatterns
Inheritance
ConstantReferencePatterns
Inherited Members

Fields

StaticClassTemplateReferencePattern

Pattern matching a constants static class reference in a UI template. Group 1 captures "ClassName" only, excluding the trailing ".ConstantName" so a class rename never touches the constant name.

public const string StaticClassTemplateReferencePattern = "\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*))\\.[A-Za-z_][A-Za-z0-9_]*"

Field Value

string

TemplateReferencePattern

Pattern matching a constant reference in a UI template. Group 1 captures "ClassName.ConstantName".

public const string TemplateReferencePattern = "\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))"

Field Value

string

Methods

CreateStaticClassTemplateReferenceRegex()

[GeneratedRegex("\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*))\\.[A-Za-z_][A-Za-z0-9_]*")]
public static Regex CreateStaticClassTemplateReferenceRegex()

Returns

Regex

Remarks

Pattern:

\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*))\\.[A-Za-z_][A-Za-z0-9_]*

Explanation:<br />
<pre><code class="lang-csharp">○ Match the string "@Constants.".

○ 1st capture group. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times. ○ Match '.'. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.

CreateTemplateReferenceRegex()

[GeneratedRegex("\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))")]
public static Regex CreateTemplateReferenceRegex()

Returns

Regex

Remarks

Pattern:

\\@Constants\\.((?:[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*))

Explanation:<br />
<pre><code class="lang-csharp">○ Match the string "@Constants.".

○ 1st capture group. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times. ○ Match '.'. ○ Match a character in the set [A-Z_a-z]. ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.