Reputation: 8568
The input accepts data in format: %'letter' separator %'letter' and so on.
The separator can be: space, tab, colon or new line
Example:
%d %F %S
or
%d:%F:%S
or
%d:%F
%S
where the character after the '%' can be any letter
You cannot write something like:
%dddd %F %S
or
%%d %F %S
So far I have done this:
^((%([a-zA-Z]){1})+\s?|:)+$
Any help will be appreciated.
Upvotes: 0
Views: 50
Reputation: 9281
You can go with this
(%[a-zA-Z][ \t\n;])*%[a-zA-Z]
But I'd suggest passing an case-insensitive flag to your matcher. Then the expression can be shortened to
(%[a-z][ \t\n;])*%[a-z]
Upvotes: 1