How to set variable only contain 3 character and not more than 3 also validate it contains only3char

Hi Dear,

please help me on the concern. I have one variable it must contains only 3 character not more than 3 char. How to do in webMethods can you please help on this.

Thanks in advance. :slight_smile:

Use Java Regex. Search on Google;



Hi Hariom,

is it one to three characters or excactly three characters?

You can define some restrictions for the field:

for the first variant it will be “maxLength=3”, for second variant it will be “length=3”.
Additionally add a regex pattern as “[A-Za-Z]” to restrict it to contain just characters.

See RegEx documentation for pattern formats.


Yep this should do the trick with regular expressions and make sure your branch is set to evaluate Labels to true for the sequence regex to work :smiley:


Another option: call pub.string:length and BRANCH on the result.

1 Like

Yes if there is no constraint on that 3 chars can be numeric or alpha and so the above option will be best bet with no syntax issues :smiley:


You may also use Validate input by :

  1. add this variable to service Input and select Validate input.
  2. set property of this variable.
  3. set content type = string_customized
  4. set length = 3