Class EditActionSearchReplace
Represents a single edit action which can be applied to a TU.
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemoryEditScripts
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
[DataContract]
public class EditActionSearchReplace : EditAction
Constructors
EditActionSearchReplace()
Declaration
public EditActionSearchReplace()
Properties
ApplyToTarget
If true, the S/R will be applied to the target segment. If false (default), it will be applied to the source segment.
Declaration
[DataMember]
public bool ApplyToTarget { get; set; }
Property Value
Type | Description |
---|---|
bool |
IgnoreCase
Gets or sets a flag whether or not to apply the pattern matching in a case-insensitive manner. For literal searches, some "intelligent" casing will be applied to the replacement. For regular expression searches, see .Net's regex documentation how case-insensitive S/R is handled.
Declaration
[DataMember]
public bool IgnoreCase { get; set; }
Property Value
Type | Description |
---|---|
bool |
PatternType
Gets or sets the type of the pattern. When searching literal patterns, the replacement must also be a literal pattern. When searching regular expression patterns, the replacement will also be interpreted as a regular expression replacement pattern.
Declaration
[DataMember]
public PatternType PatternType { get; set; }
Property Value
Type | Description |
---|---|
PatternType |
ReplacementPattern
Gets or sets the replacement for the search pattern, if found.
Declaration
[DataMember]
public string ReplacementPattern { get; set; }
Property Value
Type | Description |
---|---|
string |
SearchPattern
Gets or sets the pattern to search. If this is a regular expression, it will later be compiled with the CultureInvariant and the IgnoreCase options (if the IgnoreCase flag is set. No other regular expression flags will be applied.
Declaration
[DataMember]
public string SearchPattern { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Apply(TranslationUnit)
Declaration
public override bool Apply(TranslationUnit tu)
Parameters
Type | Name | Description |
---|---|---|
TranslationUnit | tu | The TU to apply the edit action to |
Returns
Type | Description |
---|---|
bool |
|
Overrides
Validate(IFieldDefinitions, bool)
Validates the edit action against the provided field definitions.
Declaration
public override bool Validate(IFieldDefinitions fields, bool throwIfInvalid)
Parameters
Type | Name | Description |
---|---|---|
IFieldDefinitions | fields | The field definitions to validate against. |
bool | throwIfInvalid | If true, an exception will be thrown if invalid field names or other issues are encountered. If false, the return value will be set to false without an exception being thrown. |
Returns
Type | Description |
---|---|
bool |
|