hi All good morning i am working on Reg ex for Card Expiry Date , mm\yyyy. The data validation should require the date entered by the applicant to be a future date. but htis expression accepting the mm/yy format also can any one help me ^(0[1-9]|1[0-2]|[1-9])\/(1[4-9]|[2-9][0-9]|20[1-9][1-9])$"
I'm trying to find a regex pattern to validate credit card expiration date. The format is MM/YYYY
00/0000 -> Not accepted
02/0000 -> Not accepted
00/2016 -> Not accepted
02/2016 -> accepted
12/2016 -> acceptedenter code here
13/2016 -> Not accepted
the two number of the year must be 20
the yea...
@AK Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@GayathriMohan then you'll have to customize that with the current date, making sure that 20[0-9]{2} takes into account that it needs to be greater than 2015. Of course, that logic, you'll have to change it in the year 2100
has anyone setup a local dev situation where you can save a file a rebuild your build and have the browser refresh?
i mean.. i know webpack-dev-server does this, and i wasn't using it, but I found myself needing to create my own server and now i have lost this save-to-reload feature
the thing i'm worried about is i have to re webpack my source and that takes a couple seconds alone. webpack-dev-server serves your build from memory i've heard which seems difficult to reimplement yourself
but let me expand, i had to create my own express server so that i could improve my situation with react-router. this issue where you reload and it servers you a non existent route.
but now that i'm using my own server, i lose the webpack-dev-server caching of build and all its features etc..
> nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application.
no, that's what the webpack hotloader is for
nodemon restarts the server, hot loader restarts the client
the thing with webpack dev server is it serves from memory so its fast. i hope the webpack flag you mentioned isn't something that just runs webpack in working dir on save. because i could write a SH-script to do that and it'd be too slow
I search global variable of javascript and it returns window.variable, tried to declare variable in the 1st script then transfer it to the second one. the value is undefined.
I have this code in a fiddle:
var a = 1;
function b() {
var a = 10;
alert(window.a);
}
b();
Why is a is undefined here? It's already defined in global namespace, i.e., window. (See the fiddle for an example of this unexpected behavior.)
Oh it is working on sublime. I wanted to test it first at jsfiddle cus its easy to compile but then the result isn't what i expected. Error Btw thanks for thelp!
Hello a question about the meaning of a sentence from mdn docs: *The executor function is executed immediately by the Promise implementation, passing resolve and reject functions (the executor is called before the Promise constructor even returns the created object). * Who pass what to whom?
I understand that, exactly when a Promise is created from new Promise() the executor (that which will execute the asynchronous action and resolve it with its provided resolutions) is called.
I'd hazard that "the executor is called Before [...]" really means that the executor starts executing the async action in the Promise's constructor
@Niing no, the Promise itself has no knowledge of resolve or reject.
unless you add them with then and catch. stuff added through then and catch will be passed, in turn, the result of what is called inside the executor function for both resolve and reject
@Niing Have a look at this: jsfiddle.net/LgLey900 I've made a fake promise class that just console.logs which method was called (instead of calling .then like a real promise would). The place where resolve/reject get PASSED into the executor function has a comment above it
does anyone here use express.js? i've written my api, but it's just got about 40 lines of app.get, app.post etc for all the end points. is this just how it is, or is there another way to declare a lot of api end points/routes?
it's annoying because there are so many tutorials that use a basic router, which is fine. but there's a big jump to the next level and very few how-to or best-practices. I've just muddled through, and it all works fine. Somtimes I just wonder if I am being a numpty or not lol
but i'm a masochist and i don't like to use things that make my live easier
but i think my fix involved this.. Project is running at http://localhost:8080/ webpack output is served from / 404s will fallback to /index.html
before the 404's would fallback on .. i think / .. but my index.html was actual in the dist/ dir
so by making webpack build the bundle to / i think i resolved that problem. though this seems like an imperfect solution because i should be able to build bundles to /dist or /build or w/e and not have react router routes break!!
thats right. i'm trying to figure out why react-router wasn't working on page reloads. to be clear, i solved it. i just don't know why what i did solved it.
I went to a novelty Australian bar in London. They had Tooheys New in bottles. Bottles shipped from Australia. It was cheaper to buy, in the bar, in London, than it is to buy at a bottle shop here.