Well, i know i can do it in other ways, but my point was to check if it can be done with pure numpy/torch in some "equivalent" method to a regex.
My goal is to filter regions in a differential field that show some derivate sign sequence but with a variable shape. I can easily just map positive derivates to "1", negatives to "-1", flats to "0", or whatever and use a regexp, but i thought maybe it was achievable natively in numpy :/.