Salesforce

Regular Expressions (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Regular Expressions (Magic xpa 3.x)

A regular expression is an enhanced string definition that is used to match other strings by utilizing meta-characters in order to finely set the match criteria.

Magic xpa implements the standard syntax of regular expressions.

The Locate Line and Find Text utilities of the Studio lets you locate a line or a text in the project using a regular expression syntax.

In order to indicate that the search string is not a simple string but a regular expression syntax you should select the Regular Expression check box in the dialog box.

There are many meta-characters in use of the regular expression syntax.

The following is a list of the more common meta-characters used in regular expressions.

A corresponding example appears under each meta-character:

[ ]

Represents a set of characters.

“VAR[1-3] “ will locate lines containing the sub-strings: “VAR1“,“VAR2“, and “VAR3“.

.

Matches any character or set of characters.

“a..b“ will locate lines containing any 4-character sub-string that starts with a and ends with b. For example: “aaab“,“aabb“,“afkb“,“a2vb“, etc.

^

Matches the start of a line.

“^Update“ will locate any line that starts with the sub-string “Update”.

$

Matches the end of a line.

”No$” will locate any line that ends with “No”. For example, any operation line set with “Cnd: No”.

*

Matches zero or more repetitions of the preceding character or set of characters.

“^Update.*Code" will locate any line that starts with “Update” and after any number of characters has the sub-string “Code”.

+

Matches one or more repetitions of the preceding character.

“Code_X+0” will locate any line that contains a sub-string that starts with “Code_” and is followed by one “X” character or more and then the character “0”. For example: “Code_X0”, “Code_XX0”, “Code_XXX0”, etc.

?

Matches zero or one repetition of the preceding character.

“Code_X?0” will locate any line that contains a sub-string that starts with “Code_” and is followed by zero or one “X” character and then the character “0”. For example: “Code_0”, “Code_X0”. Using this syntax, the sub-string “Code_XX0” will not be matched.

\

Escapes a meta-character to be matched as a simple character.

“Code_X\?0” will locate any line that contains the explicit sub-string “Code_X?0”.

|

A logical OR definition. Matches by either string on both sides.

“^Update|^Evaluate” will match any line that either starts with “Update” or with “Evaluate”.

{n}

Matches the preceding element n times.

“Alpha [0-9]{3}” will locate any line that has a sub-string that starts with “Alpha “ and then any 3 digit combination. For example: “Alpha 100”, “Alpha 256”, etc.

( )

Matches whatever string is inside the brackets.

“(Alpha|Numeric) [0-9]{2} ” will locate any line that has a sub-string that starts with “Alpha “ or “Numeric” and then any 3 digit combination. For example: “Alpha 20 ”, “Alpha 25 ”, “Numeric 12 ”etc.

Reference
Attachment 
Attachment