Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello,
With ACL and search functions (gsub, sub or others), how to match a repetition pattern using the characters { } ?
Exemple of a repetition pattern: [0-9]{4}.
Regards
David
Solved! Go to Solution.
ACL's regular expressions don't support explicit quantifiers (e.g. {4}). They only support *, ?, and +.
However, you can probably use Javascript and use it's much better regular expression handling to do what you need to do. Write a function in Javascript to do what you need, put it in a *.js file, make sure you load (source) it when Arbortext starts, and then you can call it using the ACL javascript() function.
ACL's regular expressions don't support explicit quantifiers (e.g. {4}). They only support *, ?, and +.
However, you can probably use Javascript and use it's much better regular expression handling to do what you need to do. Write a function in Javascript to do what you need, put it in a *.js file, make sure you load (source) it when Arbortext starts, and then you can call it using the ACL javascript() function.
Clay,
Thanks for your response.
I have used your solution using a Javascript function.
Regards
David
I like Clay's idea of piping out to another language to do the heavy lifting on regex, if you're doing a lot of clever things then you may be reaching the limits of ACL. The only other idea would be to "unroll" your repeats e.g. in your example [0-9]?[0-9]?[0-9]?[0-9]? would match between 0 and 4 numbers. That wouldn't work if you need a min/max repeat, but does work for 0-n. It is very ugly.