Page 1 of 1

Filetypes association based on wildchars or even RegEx of filename

Posted: Wed Dec 21, 2016 4:05 pm
by tatra603
Good afternoon,

would it be possible to associate filetypes to appropriate Editors (menu -> Options -> Preferences -> File Types) based not only by simple extensions, but on wildchars or even RegExs of filename? We have files, which have not simple extensions, but e.g. timestamps or iterator suffix.

So Extension could be defined for example as "syslog.[0-9]+".

Regards, Stepan

Re: Filetypes association based on wildchars or even RegEx of filename

Posted: Wed Dec 21, 2016 5:13 pm
by Radu
Hi Stepan,

Interesting idea, indeed right now we only accept simplified pattern characters, basically * and ?.
But maybe we could somehow also allow the end user to do full regexp matches, somehow we need to differentiate between the case when the end user has a simple use case (search using * and ?) and when they want to take full control and set there a regular expression.
Maybe if the matched pattern would be prefixed with something like {REGEXP}, that could be an indication to Oxygen to interpret it as a single full-featured regular expression.

Regards,
Radu

Re: Filetypes association based on wildchars or even RegEx of filename

Posted: Wed Dec 21, 2016 6:38 pm
by tatra603
indeed right now we only accept simplified pattern characters, basically * and ?
Hi, Radu,

does oXygen 18.1 currently accept wildchars? So definition of "extension" like "*.out.*" is possible? I tried just now "syslog.out.20161221" using the definition "*.out.*" and it does not look to work. Because wildchars should be fine for most of our needs.

Stepan

Re: Filetypes association based on wildchars or even RegEx of filename

Posted: Thu Dec 22, 2016 11:15 am
by Radu
Hi Stepan,

As I said the simple wildcard patterns * and ? are accepted.
Problem is that the Preferences->File Types maps file extensions to file types. So Oxygen first tries to determine the extension of the file syslog.out.20161221 and probably it gets 20161221 as the extension. And then it tries to match 20161221 with your pattern.
So this is why this probably does not work the way you expect it.

Regards,
Radu

Re: Filetypes association based on wildchars or even RegEx of filename

Posted: Thu Dec 22, 2016 11:22 am
by Radu
I think I found a workaround though, but only if your syslog.out.* are of XML type.
In the Oxygen Preferences->Document Type Association page create a new document type association with any name. In the Association Rules list add a new rule which for the file name field uses syslog.out.* with all other fields remaining with the default values.
Oxygen should understand that files with that specific file name pattern should be considered as XML (only XML documents have document type associations) and not ask you again about their type when opening them.

Regards,
Radu

Re: Filetypes association based on wildchars or even RegEx of filename

Posted: Thu Dec 29, 2016 4:09 pm
by tatra603
Radu wrote:I think I found a workaround though, but only if your syslog.out.* are of XML type
Hello, unfortunately, syslog.out is a text document, not XML one. I understand, that only in case of enough similar requests this pattern matching feature would be implemented.

Regards, Stepan