Hello there,
I have a several files with filenames like :
myfirstsong-CT_V06.mp3
mysecondsong-CT_V04.mp3
mythirdsong-CT_V11.mp3
…
which the number is the version of the song and I need to extract this number to be displayed in my app without manually typing it in the data editor.
Is there a way to do it ?
Thanks
HTML
May 11, 2025, 5:39pm
2
You can use JavaScript column, paste this code there, and in p1 put your file name:
if(p1){
const match = p1.match(/_V(\d+)/);
if (match) {
const numberAfterV = match[1];
return(Number(numberAfterV));
} else {
return("No number found");
}
} else {return 'empty'}
1 Like
You can also use the Extract Matching Text column for this.
If you want the leading 0.
_V(\d+)
This if you don’t want the leading 0.
_V(?:0(?=[1-9]))?(\d+)
2 Likes
HTML
May 11, 2025, 11:52pm
5
Yes, you can do that, but you won’t have control over errors, empty values, or missing numbers in the name. You’d need to add additional columns to handle those cases.
1 Like
Ho yes ! That works too and it doesn’t need an if-then-else to filter the results
Thank you so much
2 Likes
system
Closed
May 19, 2025, 7:40am
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.