Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
pattern = (Mr|Mrs).
searchIn = John Antonio, Mr.
replaceWith = student
startAt = 5
In the output window, you can see that Astera has returned a string value with the appended replaceWith value, as the specified pattern value was matched with the searchIn value, after the specified startAt position.
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
pattern = (Mr|Mrs).
searchIn = Mr. John
replaceWith = Sir
In the output window, you can see that Astera has returned a string value with the appended replaceWith value, as the specified pattern value was matched with the searchIn value.
IsUSPhone (String str)
Example
In this example, we will pass the required parameter to the function transformation object using a Variables object.
Where,
str = (123) 456-7890
In the output window, you can see that Astera has returned “True”, as the specified string matches a valid US phone format.
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
Pattern = {x,y}
String = A,2
In the output window, you can see that Astera has returned “False”, as the specified string does not match the specified pattern value.
Name
ReplaceRegEx
Syntax
ReplaceRegEx (String pattern, String searchIn, String replaceWith, Integer startAt)
Purpose
To scan the input string for the specified pattern starting at the StartAt position and replace it with the value specified in replaceWith parameter.
Description
If the pattern is found after the specified StartAt position, it is replaced with the ‘replaceWith’ parameter, and the resulting value is returned. Otherwise, the original value is returned.
Return Type
String
Parameters
pattern [System.String] – Regular expression pattern to match
searchIn [System.String] – String to search for a match
replaceWith [System.String] – Replacement string
startAt [System.Int64] – The character position at which to start the search
Name | ReplaceRegEx |
Syntax | ReplaceRegEx (String pattern, String searchIn, String replaceWith) |
Purpose | To scan the input string for the specified pattern and replace it with the value specified in replaceWith parameter. |
Description | If the pattern is found, it is replaced with the ‘replaceWith’ parameter, and the resulting value is returned. Otherwise, the original value is returned. |
Return Type | String |
Parameters | pattern [System.String] – Regular expression pattern to match searchIn [System.String] – String to search for a match replaceWith [System.String] – Replacement string |
Name | IsUSPhone |
Syntax | IsUSPhone (String str) |
Purpose | To return true if the number represents a valid US phone number. |
Description | Checks whether a given value represents a valid United States phone number. This method tests format and digits to determine whether the given string is potentially a valid US phone number. |
Return Type | Boolean |
Parameter | str [System.String] – Value to be checked. |
Name | IsMatchRegEx |
Syntax | IsMatchRegEx (String pattern, String str) |
Purpose | To return true if the regular expression found a match in the string. Otherwise, returns false. |
Description | Indicates whether the regular expression finds a match in a specified string value by returning a boolean value. |
Return Type | Boolean |
Parameters | pattern [System.String] – Regular expression pattern to match str [System.String] – String to search for a match |
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
pattern = {x,y}
str = 1234{x,y}
startAt = 4
In the output window, you can see that Astera has returned “True”, as the specified string matches the specified pattern value, from the specified start position.
Name
IsMatchRegEx
Syntax
IsMatchRegEx (String pattern, String str, Integer startAt)
Purpose
To return true if the regular expression found a match in the string. Otherwise, returns false. It also considers the starting position.
Description
Indicates whether the regular expression finds a match in a specified input string value at the specified integer position.
Return Type
Boolean
Parameters
pattern [System.String] – Regular expression pattern to match
str [System.String] – String to search for a match
startAt [System.Int64] – The character position from which to start the search
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
Pattern = ^H[\S]{0,4}|$
String = HelloWorld!
Note: The specified regular expression will look for and match a string which begins with “H” (case sensitive). Next, it will match any character that is not a whitespace character in the next 0 to 4 characters. Finally, the “$” is used to end the string. Therefore, the returned output should be “Hello”.
In the output window, you can see that Astera has returned a string value, as the regular expression pattern has been matched.
Example
In this example, we will pass the required parameter to the function transformation object using a Variables object.
Where,
str = 90001
In the output window, you can see that Astera has returned “True”, as the specified string matches a valid US Zip Code format.
Name
GetMatchRegEx
Syntax
GetMatchRegEx (String pattern, String str)
Purpose
To return a result if a match was found. Otherwise, returns an empty string.
Description
Scans the string for an occurrence of text matching the specified regular expression.
Return Type
String
Parameters
pattern [System.String] – Regular expression pattern to match
str [System.String] – String to search for a match
Name
IsUSZipCode
Syntax
IsUSZipCode (String str)
Purpose
To return a Boolean value indicating whether the specified string is in a valid Zip Code format.
Description
Checks whether a given value represents a valid United States Zip Code format. This method tests format and digits to determine whether the given string represents a valid US Zip code format.
Return Type
Boolean
Parameter
str [System.String] – Value to be checked.
Example
In this example, we will pass the required parameters to the function transformation object using a Variables object.
Where,
Regular Expression (Pattern) = ^H[\S]{0,4}|$
String = 1234HelloWorld!
startAt = 4
Note: The specified regular expression will look for and match a string which begins with “H” (case sensitive). Next, it will match any character that is not a whitespace character in the next 0 to 4 characters. Finally, the “$” is used to end the string. Therefore, the returned output should be “Hello”, as the startAt position is “4”.
In the output window, you can see that Astera has returned a string value, as the regular expression pattern has been matched in accordance with the defined starting position.
Name
GetMatchRegEx
Syntax
GetMatchRegEx (String pattern, String str, Integer startAt)
Purpose
To return a result if a match was found. Otherwise, returns an empty string.
Description
Scans the string, starting at the specified (interger) position, for an occurrence of text matching the specified regular expression.
Return Type
String
Parameters
pattern [System.String] – Regular expression pattern to match
str [System.String] – String to search for a match
startAt [System.Int64] – The character position at which to start the search