JavaScript jQuery regex test in .each error jquery regex test online,jquery regex test is not a

Ok, so I have multiple inputs that receive UUID codes. So Im using the .each function from jQuery to go one by one and validate the input to be a UUID code. So this is the code that I have until now:

function validateAll(){
    var regex = /^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$/ig;
    $('input.offer').each(function(x){
        if($(this).val() !== ""){
            console.log(x+" - "+$(this).val()+" - "+regex.test($(this).val()));
        }
    });
    return true;
}

Now when I run this with two inputs being: 00000000-0000-0000-0000-000000000000 this is what I get in the console:

0 - 00000000-0000-0000-0000-000000000000 - true

1 - 00000000-0000-0000-0000-000000000000 - false

Why the regex.test() is validating the first one but not second one? Thanks.

Answer:1

I've wrote a simple 'add page' form to a small CMS I've built and I have a simple preview feature which submits a form and opens the front-end version of the page in a new window. To achieve this up ...

I've wrote a simple 'add page' form to a small CMS I've built and I have a simple preview feature which submits a form and opens the front-end version of the page in a new window. To achieve this up ...

  1. submit form window.open
  2. submit form window.open javascript
  3. form submit window close
  4. form submit window.location
  5. form submit window.location.href
  6. form submit window
  7. form submit window tab
  8. submit form new window
  9. submit form on window load
  10. submit form new window javascript
  11. submit button windows form
  12. submit form popup window
  13. submit form using window.open
  14. submit form modal windows
  15. submit form open new window
  16. submit form to parent window from iframe
  17. javascript form submit window.location
  18. submit form in parent window from popup
  19. submit form in new window jquery
  20. submit form to popup window jquery

I follow the practice of always using a absolute comparison '===', but some learned colleagues have argued that this is an unnecessary waste of computation time on type-checking in situations where ...

I follow the practice of always using a absolute comparison '===', but some learned colleagues have argued that this is an unnecessary waste of computation time on type-checking in situations where ...

currently,i learn node-mysql in node.js,but I meet a question,try a lot,i don't how to solve it ? like this: var express = require('express'); var app = express(); var mysqlcon=require('./testmysql')...

currently,i learn node-mysql in node.js,but I meet a question,try a lot,i don't how to solve it ? like this: var express = require('express'); var app = express(); var mysqlcon=require('./testmysql')...

  1. inner ear
  2. inner core
  3. inner monologue
  4. innersense
  5. inner ear infection
  6. inner planets
  7. inner join
  8. inner circle
  9. inner transition metals
  10. inner thigh workouts
  11. inner thigh pain
  12. inner knee pain
  13. inner peace
  14. inner space caverns
  15. inner ear pain
  16. inner harbor
  17. inner core definition
  18. innerspace
  19. inner elbow pain
  20. inner engineering

This is such a fundamental question, that I'm sure it's a duplicate, so I apologize in advance, but is this how I write an object such that I use by saying: myApplication.myFirstMethod(x); x = ...

This is such a fundamental question, that I'm sure it's a duplicate, so I apologize in advance, but is this how I write an object such that I use by saying: myApplication.myFirstMethod(x); x = ...

  1. javascript getter setter es6
  2. javascript getter setter same name
  3. javascript getter setter vs function
  4. javascript getter setter in function
  5. javascript getter setter prototype
  6. javascript getter setter best practice
  7. javascript getter setter class
  8. javascript getter setter example
  9. javascript getter setter array
  10. javascript getter setter performance
  11. javascript getter setter es5
  12. javascript getter setter property
  13. javascript getter setter in constructor
  14. javascript getter setter object
  15. javascript getter setter object literal
  16. javascript getter setter mdn
  17. javascript getter setter browser support
  18. javascript getter setter variable
  19. javascript getter setter polyfill
  20. javascript getter setter defineproperty