1

I have a string:

var test = 'filename.hash12345678.js';

All i know at that stage is filename itself. i don't know hash. Now, I need to do axios call, but because i don't know what comes after the filename, i can't put the actual path in the axios. how Can I get the whole path of the file ?

axios.get(`${filename}.whattoputhere`);

How can I achieve this with regex ?

Nika Kurashvili
  • 4,270
  • 4
  • 22
  • 68
  • 1
    Split by `.` and get 2nd part – anubhava Sep 08 '20 at 11:22
  • Looks like you are looking to create a regex, but do not know where to get started. Please check [Reference - What does this regex mean](https://stackoverflow.com/questions/22937618) resource, it has plenty of hints. Also, refer to [Learning Regular Expressions](https://stackoverflow.com/questions/4736) post for some basic regex info. Once you get some expression ready and still have issues with the solution, please edit the question with the latest details and we'll be glad to help you fix the problem. – Wiktor Stribiżew Sep 08 '20 at 11:24
  • I don't have the `test` variable at all. All I know is filename. – Nika Kurashvili Sep 08 '20 at 11:26

0 Answers0