I have an input string of the format abc;def;ghi;jkl;........
and so on. the smallest allowed input string is abc
, while there is no limit on max number of tokens. Also the length of each token is NOT fixed to 3. it can be any number of characters.
for eg, america;russia;uae
is also an accepted input
I want to take out the first three tokens and make separate properties out of them. In case there are less than 3, then those respective tokens should be NULL
.
So far I have tried a lot of regular expressions (which I am not comfortable with)
${testprop}
contains the input string.
i am using the following command
propertyregex property="testprop1" input="${testprop}" regexp="(.*)(\;.*)*/" select="\1"
but it is not working. any suggestions for a better regex !!
/(?i)\b([\w]{1,2}(?=;))/
Try this regex – om39a Dec 28 '12 at 5:09