cancel
Showing results for 
Search instead for 
Did you mean: 

string operation for search pattern

Former Member
0 Kudos

Hi,

how to find string as per search pattern given by user ?

regex method 'find' (boolean matchFound = matcher.find();) searches for occurance of exact string

but requirement is that if user gives AS then result list should consider the search pattern like starting from A and containing S

thanks in advance for help

b

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Could you please specify whether you are using this in message mapping and AS is an identifier or what?

cheers,

Abhishek.

bhakti2
Active Participant
0 Kudos

hi,

I followed this link and it works for me

Link:[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1624] [original link is broken];

but i preceded * with . myself so that end user doesnt have to do it (pl refer link for details)


       patternStr0= //give the filter value given by user
       patternStr=""; 	
        char c = '*';
	char fieldValueCharArray [] = patternStr0.toCharArray();
	for (int i = 0; i < fieldValueCharArray.length; i ++) {
		if (fieldValueCharArray<i> != '\\')
		{
			if (fieldValueCharArray<i> == c) patternStr += "."+fieldValueCharArray<i>;
			else                             patternStr += fieldValueCharArray<i>;
		}
		} 
    boolean match = inputStr.matches(patternStr); 

Answers (2)

Answers (2)

bhakti2
Active Participant
0 Kudos

.

stefan_grube
Active Contributor
0 Kudos

what are you talking about?

Is this PI related?