Using Regular Expressions with Oracle BPEL:
Sometimes we may have to validate the data based on the Regular Expressions.
xp20:matches() is a function which can be used to compare
data with regular expressions. This function returns true when the input
matches the given expression.
xp20:matches(intputString, regexPattern)
- inputString - The input string
- regexPattern - The regular expression pattern
Validation of numeric fields :
xp20:matches(bpws:getVariableData('inputString'),'^[0-9]*$')=true()
Validation of alpha fields :
xp20:matches(bpws:getVariableData('inputString'),'^[A-Za-z]*$')=true()
Validation for list of values:
xp20:matches(bpws:getVariableData('inputString'),'^(A|B|C|D)$')
=true()
The matches function returns true if inputString variable
contains any one of these values (A, B, C, and D).
The expression can be replaced with other regular
expressions for similar comparisons.