JS/Jquery, Match not finding the PNG = match('/gif|jpg|jpeg|png/')?

A couple of things Match accepts an object of RegExp not a string. It may work in some browsers, but is definitely not standard gif". Match('/gif|png|jpg/'); // null​​​​​​​​​​​​​​​​​​​​​​​​​​​​ Without the strings gif".

Match(/gif|png|jpg/); // "gif" Also, you would want to check these at the end of a filename, instead of anywhere in the string isthisagif. Nope". Match(/(gif|png|jpg|jpeg)/); // "gif", "gif" Only searching at the end of string with $ suffix isthisagif.

Nope". Match(/(gif|png|jpg|jpeg)$/); // null No need to make href lowercase, just do a case insensitive search I Look for a dot before the image extension as an additional check And some tests I don't know how you got any results back with using a string argument to match What browser are you on?

A couple of things. Match accepts an object of RegExp, not a string. It may work in some browsers, but is definitely not standard."gif".

Match('/gif|png|jpg/'); // null​​​​​​​​​​​​​​​​​​​​​​​​​​​​ Without the strings "gif". Match(/gif|png|jpg/); // "gif" Also, you would want to check these at the end of a filename, instead of anywhere in the string."isthisagif. Nope".

Match(/(gif|png|jpg|jpeg)/); // "gif", "gif" Only searching at the end of string with $ suffix "isthisagif. Nope". Match(/(gif|png|jpg|jpeg)$/); // null No need to make href lowercase, just do a case insensitive search /i.

Look for a dot before the image extension as an additional check. And some tests.. I don't know how you got any results back with using a string argument to .match. What browser are you on?

I guess the fact that it'll match anywhere in the string (it would match "

tshop.com/" for instance) could be considered a bug. I'd use /\.(gif|jpe? G|png)$/i.

You are passing a string to the match() function rather than a regular expression. In JavaScript, strings are delimited with single quotes, and regular expressions are delimited with forward slashes. If you use both, you have a string, not a regex.

Match accepts an object of RegExp, not a string. It may work in some browsers, but is definitely not standard. Also, you would want to check these at the end of a filename, instead of anywhere in the string.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions