regular expression help

I have a question regarding pattern searching with grep.

I have read tutorials all over the place and pretty much understand how to search for patterns and recurring patterns. I, however, need to search for words which have non-repeating occurances.

My task is to parse a 'permissions' string, ie "ug=rx,o=rw" or "ugo=rwx"

Take the string 'ugo' or 'oug', I basicaly need "grep [ugo][ugo][ugo] but they cannot repeat.

Ie, [ugo]\{3\} but not allow string such as "uuu"

Thanks in advance

Just for clarification:
Your input string is in the format of:

ug=rx,o=rw
ugo=rwx

So, each line can have one or more statements of [ugo] = [rwx]

What are you looking for? Every instance where there is a U&G&O? Instances where there's more than one statement (like the first line)?

Just a little more clarity might help someone with this...

In regular expressions, this allows repetition:

[UGO]

This does not:

(U|G|O)

I don't know the exact syntax in grep, though.

I guess I wasnt't too clear. Lets take an example:

The string in question can be an anagram of 'ugo', ie uog, gou, etc.

I need a regular expression to search for a string like this, where there are only 3 allowed characters, can be in any order, and are not allowed to repeat.

The basic pattern is

u?g?o?(=r?w?x?)?

There is no provision to inline the requirement that there be at least one of ugo and one of rwx for the expression to match; with Perl, you can do lookaheads which accomplish this.

(?=[ugo])u?g?o?(=(?=[rwx]r?w?x?))?

Multiple comma-separated repetitions of this pattern left as an exercise.

Posted while you added your clarification. The above doesn't exactly match your refined requirements. I don't think you can get arbitrary order without repetition without enumerating the possible permutations.

ug?o?|uog?|gu?o?|gou?|og?u?|oug?

since there arent too many permutations, your solution seems to work well era, thx for the help