Jump to content

gw1500se

Members
  • Posts

    1,029
  • Joined

  • Last visited

  • Days Won

    16

Posts posted by gw1500se

  1. Not sure how this became part of the previous topic although it is related in in that it is applying that solution. I thought I started a new topic. What I posted was the string before running it through Javascript RegExp. I assumed that the string was supposed to be a regexp expression string that RegExp would convert. Are you saying that the string should just be:

    FRENCH

  2. It is still not clear what you are trying to do. Do users click on a link and see the time for the next upload? Perhaps you need to show some code of what you tried and what didn't work. Be sure to use the code icon (<>) and specify PHP

  3. For testing, config_data.excludes has one entry:

    Array(1)

    0: "/FRENCH*/"

    length: 1

    items.title has many entries but these are typical:

    skipping Pick a Youtube thumbnail/title (~10 seconds)
    skipping Survey for $0.25 (~4 Minutes)(~ 4 minutes)
    skipping 2-minute study for $0.30(~ 2 minutes)
    skipping 2023 Plans

    As you can see the code is "skipping" even though 'FRENCH*' does not exist in those strings.

  4. This is not working as expected. Perhaps I am missing something. First I do this:

    regexes=[]
    for (let item in config_data.excludes) {
       regexes.push(new RegExp(item));
    }

    'config_data.excludes' is an array of strings representing regexps.

    Then I do this in a loop:

    if (regexes.some(re=>re.test(item.title))) {
         console.log("skipping "+item.title)
         continue;
    }

    This block is in a loop (item.title) so the 'continue' will skip to the next item in the loop. Unfortunately, it finds the 'if' is always true although none of the items contain any of the rexexps. I didn't let it run long enough to actually encounter a title that does match but is the return boolean backwards from what I expected?

  5. 1 hour ago, requinix said:

    Well there has to be a loop somewhere, question is whether you write it yourself or not.

    Array.some

    const regexes = [/a/, /b/, /c/, /d/, /e/];
    const input = "something";
    
    const any = regexes.some(re => re.test(input));

     

    I don't want to write the loop myself if I don't have to which was what I was trying to say. I don't think I understand what you did. First don't you need to run 'regexes' through the 'RegExp' function? Then is 'test' a function of 'some'? I was not able to follow the link you provided as it relates to this question. I assume from the documentation that 'any' will be either 'true' or 'false', right?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.