V
viki
How can I build regex that matches all characters of the string $STR
in any order with .* added between any two characters: ?
And without generating all N! transpositions (where N is length of
$STR) ?
Example.
For $STR "abc", I want to match equivalent to:
/(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
Generating all transpositions is not feasible for larger legths of
$STR.
/[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
What is good solution ?
Thanks
vkm
in any order with .* added between any two characters: ?
And without generating all N! transpositions (where N is length of
$STR) ?
Example.
For $STR "abc", I want to match equivalent to:
/(a.*b.*c)|(a.*c.*b)|(b.*a.*c)|(b.*c.*a)|(c.*a.*b)|(c.*b.*a)/
Generating all transpositions is not feasible for larger legths of
$STR.
/[abc].*[abc].*[abc]/ is easy and fast but gives false positives.
What is good solution ?
Thanks
vkm