Search characters pattern in Outsystems

I am trying to find a way to get the string of a couple characters. Is there a way I can get the string in Outsystems? Does the platform has some action to the search?

I am trying to return as output the record date that in this string.

{"record_date":["2018-01-20T15:51:05Z"],"record_name":["MyRecord.txt"]}

Solution

Hi Simone,


You can use Regex_Search  function from Text library.

Simply add the following pattern and you will have the record date and then you can assign its output to a variable.

record_date:\[(.*?)\"\]


Solution

Simone Guimarães Ferreira wrote:

I am trying to find a way to get the string of a couple characters. Is there a way I can get the string in Outsystems? Does the platform has some action to the search?

I am trying to return as output the record date that in this string.

{"record_date":["2018-01-20T15:51:05Z"],"record_name":["MyRecord.txt"]}

Hello Simone.

I'm assuming the string you want to parse is the following in that example: "2018-01-20T15:51:05Z"

If so , you can use the platform's built in function Substr(t,start,length), where t is the text you want to parse, start is the 0 based index of where on the string you want to start parsing and lenght is the number of character you want to include in the output.

So you should do an assign to a variable and say that the value = Substr("2018-01-20T15:51:05Z",0,10) 

which should output the following string: "2018-01-20"

This will work as long as the format of the text is always the same you mentioned above.


Danilo Batista wrote:

Simone Guimarães Ferreira wrote:

I am trying to find a way to get the string of a couple characters. Is there a way I can get the string in Outsystems? Does the platform has some action to the search?

I am trying to return as output the record date that in this string.

{"record_date":["2018-01-20T15:51:05Z"],"record_name":["MyRecord.txt"]}

Hello Simone.

I'm assuming the string you want to parse is the following in that example: "2018-01-20T15:51:05Z"

If so , you can use the platform's built in function Substr(t,start,length), where t is the text you want to parse, start is the 0 based index of where on the string you want to start parsing and lenght is the number of character you want to include in the output.

So you should do an assign to a variable and say that the value = Substr("2018-01-20T15:51:05Z",0,10) 

which should output the following string: "2018-01-20"

This will work as long as the format of the text is always the same you mentioned above.



I was searching for the entire string date

Simone Guimarães Ferreira wrote:

Danilo Batista wrote:

Simone Guimarães Ferreira wrote:

I am trying to find a way to get the string of a couple characters. Is there a way I can get the string in Outsystems? Does the platform has some action to the search?

I am trying to return as output the record date that in this string.

{"record_date":["2018-01-20T15:51:05Z"],"record_name":["MyRecord.txt"]}

Hello Simone.

I'm assuming the string you want to parse is the following in that example: "2018-01-20T15:51:05Z"

If so , you can use the platform's built in function Substr(t,start,length), where t is the text you want to parse, start is the 0 based index of where on the string you want to start parsing and lenght is the number of character you want to include in the output.

So you should do an assign to a variable and say that the value = Substr("2018-01-20T15:51:05Z",0,10) 

which should output the following string: "2018-01-20"

This will work as long as the format of the text is always the same you mentioned above.



I was searching for the entire string date

So you are looking for this "2018-01-20T15:51:05Z"? 

The example you gave looks like a json if it is, you can just serialize it to a matching structure and access the value direclty without having to parse it at all.

If its not a json than you can use regex as Leonardo Mentioned above.

Good luck


Hi Simone, you can use the Index function. You can get more information at this link: 

 https://success.outsystems.com/Documentation/Development_FAQs/How_to_find_out_if_a_string_is_contained_in_another_string