Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Regular expression to validate a string

Hi Team

I am looking for a regular expression to match 3 pre-defined values under a simple string attribute of type text.
The requirement is to enter either of the three values:
Required, Not Required, Done

I have written the below expression to validate:
(^|\s)Required|Not Required|Done(\s|$)

This works only for the first value.
If I enter the same value or different value on the new line; it gives me an error.

Please let me know what am I missing here.

Thanks
Rajat

0 votes

Comments

Managed to get the following expression working


((Done)\n|(Required)\n|(Not Required)\n){0,3}

However it is case sensitive even if we remove the check mark from the validator.

Any suggestions??

Use the "i" switch.

 Thanks but it does not work when using \n.

I have entered regular expression as:
((Required)\n|(Done)\n|(NotRequired)\n){0,7}

Could you give me an example as to how can 'i' switch work on this.

Regards
Rajat


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: May 06 '16, 3:42 a.m.

Question was seen: 1,287 times

Last updated: May 09 '16, 7:46 a.m.

Confirmation Cancel Confirm