FORUMS: list search recent posts

Regular expressions in CatDV Worker // Looking for right syntax

COW Forums : Square Box CatDV

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Leonid Nekrasov
Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 11:20:17 am

Hi everybody,

I have a question about using the regular expressions in Worker. I am trying to set up a job, where the Worker only proceed the files, that start with a word "test" in a filename.

For example:

test_123.mov
testimesti.mp4
test me.mov

but not

12test.mov
A_test.mov

after I tried everything and read many different tutorials about using the regular expressions, I still can't figure out the right expression. I try to use it in the field "Include" under "Conditions/Basic Attributes" in Worker.

Can anybody please help me. I think many users would find your Tip useful. Regular expressions is a very powerful tool, that I try to learn and that can significant boost the power of CatDV Worker.

Best Regards
leo


Return to posts index

Bob Spencer
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 8:25:05 pm

Hi, Leonid-
I agree that the use of regular expressions opens up some very powerful CatDV functionality, and there are a few integrators like us that have already explored REGEX in detail. For simple explanation and examples, look at the Worker release notes

For your immediate needs, I think you can use a simple match of the filename ("Basic Attributes" under Conditions, or variable $g if used in a formula) which tests for string "test" at the beginning of the filename, e.g.

/^(test)(S+)[^/]*$/

Make sure you remember to check the the REGEX box!

Bob Spencer
Video Technologies Group LLC
bob "at" vtgny dot com


Return to posts index

Rolf Howarth
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 8:32:36 pm

The FULL regular expression, given that I assume you only want to match files that start with "test", not for that text appearing somewhere else in the file path, would be

^.*/test[^/]*.mov$

What the characters mean is:

^ = match start of string
.* = any number of any characters (. = any character, * = repeat previous match any number of times)
/test = literal "test" right after a file path separator (assuming you're on Mac OS)
[^/]* = any number of non-/ characters, as you want to ensure that "test" occurred in the final filename component of the path
. = matches a period "." ( means "escape" the next character and ignore its usual special meaning)
mov = literal "mov"
$ = match end of string

This expression is "anchored" to the start and end of the string and gives you maximum control, but it's quite complex. As a shortcut, the worker will also recognise common Mac and Windows command line abbreviations, so you should also be able to write

test*.mov

to do what you want.



Return to posts index


Rolf Howarth
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 8:35:02 pm

Ok, it looks like the forum has stripped out my backslash characters! It obviously uses \\ itself as an escape character. That should have read

^.*/test[^/]*\\.mov$

-Rolf



Return to posts index

Rolf Howarth
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 8:36:08 pm

Aargh! I give up. Previously it stripped out my backslash, now it's doubled it up!



Return to posts index

bryson jones
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 7, 2011 at 10:27:20 pm

^.*/test[^/]*\.mov$

Did you mean this, Rolf?

bryson

bryson "at" hidefcowboy.com

hidefcowboy.com


Return to posts index


bryson jones
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 8, 2011 at 4:01:03 am

That one works, as tested in Worker Node 4 today.

Thank you Bob and Rolf both. There are tons of regex resources on the web, but a lot of them give info that doesn't pertain to the app but this should be enough to start from.

Worker Node is not an app, it's a career. ;)

bryson

bryson "at" hidefcowboy.com

hidefcowboy.com


Return to posts index

Bob Spencer
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 8, 2011 at 7:22:41 am

It's a small club!

There may be one more edit required, as Leo also wants to match for other file types that start with "test" (e.g., testtime.mp4):

try this, which blends the previous methods:
^.*/test[^/]*.*$

Good luck, Leo!

Bob Spencer

Video Technologies Group LLC
bob "at" vtgny.com
vtgny.com


Return to posts index

Leonid Nekrasov
Re: Regular expressions in CatDV Worker // Looking for right syntax
on Dec 13, 2011 at 9:35:20 am

Thanx everybody. This will bring me much further. I think this and some other often needed examples of using regular expressions belong into the manual of the Worker ;)

Regards
Leo


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]