Hi,
trying to add hierarchy. For this, I try to extract "SA" from jobname
D_SA_1040.pdf
The used regex is
(?<=[a-zA-Z]{1}_)[a-zA-Z]{2}
It does not work. Is lookbehind supported by Switch?
Kind regards,
Jörg
regex: Lookbehind not supported?
-
- Member
- Posts: 30
- Joined: Mon Mar 21, 2011 2:30 pm
regex: Lookbehind not supported?
Lookbehind is indeed not supported.
I assume you are using this regular expression in the Search field of the Job.NameProper variable. There Switch only matches the first occurrence, so [a-zA-z]{2} would also return SA.
Freddy
I assume you are using this regular expression in the Search field of the Job.NameProper variable. There Switch only matches the first occurrence, so [a-zA-z]{2} would also return SA.
Freddy
-
- Member
- Posts: 30
- Joined: Mon Mar 21, 2011 2:30 pm
regex: Lookbehind not supported?
Thanks Freddy for the reply.
There are also other filenames that are different (SE_MM_1804, ...), so the regex needed in production enviroment is
(?<=[a-zA-Z]{1,2}_)[a-zA-Z]{2}
How could i solve this issue. Is a script expression possible?
Supports javascript lookbehind (with variable length)?
It seems most languages only supports lookbehind (if they supports) with fixes length.
Kind regards,
Jörg
There are also other filenames that are different (SE_MM_1804, ...), so the regex needed in production enviroment is
(?<=[a-zA-Z]{1,2}_)[a-zA-Z]{2}
How could i solve this issue. Is a script expression possible?
Supports javascript lookbehind (with variable length)?
It seems most languages only supports lookbehind (if they supports) with fixes length.
Kind regards,
Jörg
-
- Advanced member
- Posts: 230
- Joined: Thu Aug 07, 2014 10:04 am
regex: Lookbehind not supported?
If I understand correctly you want to extract the different segments of the name. Should not be a a problem in a script expression.
Nameproper.split("-")
Or did I misunderstand you
Nameproper.split("-")
Or did I misunderstand you
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
regex: Lookbehind not supported?
Joerg Schober wrote: try to extract "SA" from jobname
D_SA_1040.pdf
A script expression to retrieve "SA" part would be:
job.getNameProper().split("_")[1];
D_SA_1040.pdf
A script expression to retrieve "SA" part would be:
job.getNameProper().split("_")[1];