Survey banner
The Dataiku Community is moving to a new home! We are temporary in read only mode: LEARN MORE

Regex function to return string between 2 characters

Level 3
Regex function to return string between 2 characters

I'm trying to create a regex function that gives me the string between 2 characters

I have the string below 



and I'm trying to return everything after the 7th instance of "_" and before ".txt"

Desired output: word8_length_string


is there a way to use a regex function / regex tool to accomplish this?

Operating system used: windows

0 Kudos
2 Replies


What is exactly your context ?
If you are using a prepare recipe you can use a formula step and use this regular expression:

match(your_column_name, '^(?:[^_]*_){7}(.*)\.txt$')[0]

Note that this regexp explicitly does what you describe, it really counts 7 instances of _ then return everything before .txt

More info about the formula processor here

If you are in a python code recipe, the same regular expression will work as well.


0 Kudos

Some alternatives:

0 Kudos


Labels (1)
A banner prompting to get Dataiku