[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] help on classAd regexp



But the important question is which regular expression patterns are supported?

The man page says everything in libpcre (and provides a link); scroll up a bit from the documentation you linked.

However, the following Perl script produces "FALSE" and "TRUE" for me, so I don't think the problem is with our `regexp()` call:


$s = 'T1_a, T1_b';
if( $s =~ m/(T1){2}/ ) {
    print( "TRUE\n" );
} else {
    print( "FALSE\n" );
}
if( $s =~ m/(T1){1}/ ) {
    print( "TRUE\n" );
} else {
    print( "FALSE\n" );
}


A coworker identified the conceptual problem, which is that /(T1){2}/ means /(T1)(T1)/, not "any two copies of the string T1 in the source string."


If the list is a stringlist (as your examples are), then it's not hard to generate a table of job IDs to the number of stringlist members
containing a substring:

condor_q -af GlobalJobID AutoClusterAttrs | ./little-python-script Request
azaphrael.org#1006.0#1776117754 4

-- ToddM

little-python-script:

#!/usr/bin/env python3

import sys
for line in sys.stdin.readlines():
    (globalJobID, remainder) = line.split(" ", 1)
    count = 0
    for item in remainder.split(","):
        if sys.argv[1] in item:
            count += 1
    print(f"{globalJobID} {count}")