Iam trying to BRANCH on a variable that variable should contain a number, so if the variable contains a number then in should process one SEQUENCE, if that variable contains other than number it has to process $default:SEQUENCE.
For that iam using the regular expression, in webMethodsDeveloper.pdf it was given for \d Match any digit. Same as [0-9].
Example doc.p[/part \d555-A/].text
I have tried so many possiblities.
What is the REGULAR EXPRESSION for the number (only).
Thanks in advance.
The expression is %char% = /[0-9]/ for comparing whether a char is numeric or not.Also make sure you set Evaluate-Labels property of Branch step to True.
i did the same but its not working.
the error is
com.wm.lang.flow.FlowException: [ISC.0049.9012] Cannot define switch and use label conditions at ‘unlabeled BRANCH’
this error comes when i set Evaluate-Labels property of Branch step to True.
Just make sure you dont have anything set in the switch property of Branch.Just select Evaluate labels to ‘true’ over there.Inside the Branch step give the expression as given by Bhaskar in the labels of child steps.Your problem will be solved.
i hope u r putting ‘char’ in Branch step with Lebel=True, which will not work, so do like this,
Branch Evaluate -Label=True,
in Sequence step, mention %char%=/[0-9]/ at Label property.
Hi Bhaskar and Puneet,
i have kept %char%=/[0-9]+/ in the sequence label.
i have included only + to get if there are more that one digit and its working.
Thanks for the help guys.
Do we have any difference between a Java REGULAR EXPRESSION’s and a webMethods REGULAR EXPRESSION’s.
My filename is Date_DBILL_date_time.DAT
I have to find the DBILL in the file name using regular expression and ftp it to the corresponding folder.
How should i give it.
Thanks In advance.
There are a few posts here on Regex examples and I think even an eZine article. Here is a basic primer on regular expressions.
BRANCH on ‘/filename’
…/DBILL/: SEQUENCE (filename contains DBILL)
Appendix B in the Developer’s Guide describes the regex facilities in IS.
Hi Rob Eamon
It’s working thanks for the help
But one more question in Developer guide the regular expression is doc.p[/\bport\b/].text but /DBILL/ is working.
Is there any difference between the java regular expressions and webMethods regular expressions.
Plz clarify my doubt. So that I can move further in using the regex.
The Developer guide focuses on using regular expressions when using WQL in the pub.xml:queryXMLNode service, thus the doc.p references throughout. In the many examples provided in the doc, you can use the text within and including the slashes. For the example,
you could use the /\bport\b/ within a BRANCH switch label to test if the BRANCH variable has the whole word “port” within it.
The article Mark referenced is at
As for wM regex compared to Java 5.0/1.5 there are probably differences but in a cursory review, I haven’t seen any that I could point out. Since wM regex predated the Java regex we shouldn’t be surprised if there are a few though. Sun says Java regex is similar to Perl regex (http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html).
A summary of the Java regex constructs is located at http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
I use a little regex test service to verify that any of the regex constructs I create do exactly what I need.
Input: input (string)
Output: result (string)
BRANCH on ‘input’
…/DBILL/: MAP (Put your regex in the label here. Map sets result to “hit”)
…$default: MAP (Map sets result to “no hit”)
When the service is run in Developer, you get prompted for input and the output shows whether the regex matches the input or not. This makes it easy to test various input conditions, such as null variable, empty variable, only spaces, “real” content, etc. Once my regex is “debugged” I copy it to the real place in the integration where it is needed.
Can you please help me for regular expression. my requirement is if variable contain char then only its execute remaining code otherwise it will go to exit $flow.
Now i am using %char%== “/[A-Za-Z]/”
Here is the simple logic to check the condition as for your needs:
Service Snippet as an Example:
Create a new service "testChars" → Logic as follows
Map (testChar) - service input and pass some chars)
Branch Evaluate -Label=True,
(under Inside this branch)
Add Sequence step, mention %testChar% ==/[A-Za-z]/ at Label property.
–>If the testChar has chars the step inside this sequence executes else
Add another Sequence step (select $default at Label property)
→ Add EXIT $flow step
Try the above and test the flow and it should work.
I agree with RMG. Give a try and update if you see any issues.