Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Square Box CatDV Regular expressions in CatDV Worker // Looking for right syntax

  • Regular expressions in CatDV Worker // Looking for right syntax

    Posted by Leonid Nekrasov on December 7, 2011 at 11:20 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

    Leonid Nekrasov replied 14 years, 5 months ago 4 Members · 8 Replies
  • 8 Replies
  • Bob Spencer

    December 7, 2011 at 8:25 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

  • Rolf Howarth

    December 7, 2011 at 8:32 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.

  • Rolf Howarth

    December 7, 2011 at 8:35 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

  • Rolf Howarth

    December 7, 2011 at 8:36 pm

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

  • Bryson Jones

    December 7, 2011 at 10:27 pm

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

    Did you mean this, Rolf?

    bryson

    bryson “at” hidefcowboy.com

    hidefcowboy.com

  • Bryson Jones

    December 8, 2011 at 4:01 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

  • Bob Spencer

    December 8, 2011 at 7:22 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

  • Leonid Nekrasov

    December 13, 2011 at 9:35 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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy