regular expression to find a substring inside a string

Hi,

I have 2 arrays.
1)/errorDetailDoc/Events
2)/ErrorHandlingProperties/properties/ErrorCategory/NetworkException/NetworkError

I am doing a nested loop, then I should search if the 1st array element contains the 2nd array element.
Suppose, the 1st array element is :: “we can not find a solution for this”
the 2nd array element is :: “find a solution”
I should search if “find a solution” is present in “we can not find a solution for this”

To achieve this, I am using a sequence and I am writing the label like:

%errorDetailDoc/Events/ErrorDump% = /%ErrorHandlingProperties/properties/ErrorCategory/NetworkException/NetworkError%/

But this is not working.
Can somebody please help me on this.

Regards
Jyoti

HI,

Loop over both the array elements first and
Take branch step, and set evaluate labels to true
then, move the sequence ( your code) inside branch as a child sequence.

Regards,
Sreekanth

Hi Jyoti,

There are some problems in what you say.

  1. You say that you want to check for containment and yet you test the equality

  2. %errorDetailDoc/Events/ErrorDump% = /%ErrorHandlingProperties/properties/ErrorCategory/NetworkException/NetworkError%/ is not correct

the / characters should be inside the %%

My suggestion is:

  1. to check the WMPublic services to see if there is a service that checks the containment of a string within another string
  2. if no such service exists you can make your own java service that can easily test the containment (Java String contains() method example).

Hope this helped,
Vlad Turian

Hi Jyoti,

Additiionally you can check out the PSUtilities Package available from tech community downloads section.

Regards,
Holger

If you don’t want to use java service, you can just try:
WmPublic/pub.string:indexOf
give the first and 2nd string as the parameters.

Hi Jyoti,

You can try below Reg Exp statement as it is used for searching a document with specific string .

%errorDetailDoc/Events/ErrorDump%.p[/%//ErrorHandlingProperties/properties/ErrorCategory/NetworkException/NetworkError%///]

But in this case you cannot use this in side label property of any service as label works on Boolean functions.

For more details in regular expression you can refer the below documents on page no 1120.

http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite9-9/Designer/9-9_Service_Development_Help.pdf

better use pub.string:indexOf built in service or any java Service.

Regards,
Ashish Kumar

Hi All,

I wrote a java service to check if one string is contained inside another string and it worked. :slight_smile:
Thanks a lot everyone for your help.

Regards
Jyoti