click below
click below
Normal Size Small Size show me how
Javascript regex
Javascript with regex
Question | Answer |
---|---|
"^" | "Start of string" |
"$" | "End of string" |
"." | "Any single character" |
"(a|b)" | "a or b" |
"(...)" | "Group section" |
"[abc]" | "In range (a, b or c)" |
"[^abc]" | "Not in range" |
"\s" | "White space" |
"a?" | "Zero or one of a" |
"a*" | "Zero or more of a" |
"a*?" | "Zero or more of a |
"a+" | "One or more of a" |
"a+?" | "One or more of a" |
"a{3}" | "Exactly 3 of a" |
"a{3}" | "Exactly 3 of a" |
"a{,6}" | "Up to 6 of a" |
"a{3, 6}" | "3 to 6 of a" |
"a{3,6}?" | "3 to 6 of a, ungreedy" |
"\" | "Escape character" |
"[:punct:]" | "Any punctuation symbol" |
"[:space:]" | "Any space character" |
"[:blank:]" | "Space or tab" |
"g" | "Global Match" |
"i" | "Case–insensitive" |
"m" | "Multiple lines" |
"exec()" | "tests for a match in string |
"test()" | "tests for match in string |
"toString()" | "returns string value of regular expressions" |
"global" | "checks if "g" modifier is set for RegEx |
"ignoreCase" | "checks if "i" modifier is set for RegEx |
"lastIndex" | "specifies index at which to start next match |
"multiline" | "checks if "m" modifier is set for RegEx |
"source" | "returns the text of the RegEx pattern" |
"A.constructor" | "returns function that created the array object's prototype" |
"A.length" | "sets or returns the number of objects in an array" |
"A.prototype.name=value" | "allows addition of new properties and methods to array" |
"A.concat( B | C |
"A.join( null|separator )" | "joins elements of array into string and returns string" |
"A.pop()" | "removes last element of array and returns shortened array" |
"A.push( item1 | item2 |
"A.reverse()" | "reverse order of elements in array and returns reversed array" |
"A.shift()" | "removes first item in array and returns shortened array" |
"A.slice(n | m)" |
"A.sort( null|sortfunction )" | "sorts items of an array |
"A.splice(n | r |
"A.unshift( item1 | item2 |
"string.valueOf()" | "returns primitive value of string object" |
"Math.abs(x)" | "returns absolute value of number x" |
"Math.acos(x)" | "returns arccosine of number x" |
"Math.asin(x)" | "returns arcsine of number x" |
"Math.atan(x)" | "returns arctangent of number x" |
"Math.atan2(y | x)" |
"Math.ceil(x)" | "returns number x rounded upwards to nearest integer" |
"Math.cos(x)" | "returns cosine of number x" |
"Math.E" | "returns Euler's number" |
"Math.exp(x)" | "returns Ruler's number to the x power" |
"Math.floor(x)" | "returns number x rounded downwards to nearest integer" |
"Math.LN10" | "returns natural logarithm of 10" |
"Math.LN2" | "returns natural logarithm of 2" |
"Math.log(x)" | "returns natural logarithm of x" |
"Math.LOG10E" | "returns base 10 logarithm of Euler's number" |
"Math.LOG2E" | "returns base 2 logarithm of Euler's number" |
"Math.max(n1 | n2 |
"Number.MAX_VALUE" | "returns largest possible number in javascript" |
"Number.MIN_Value" | "returns smallest possible number in javascript" |
"Number.NaN" | "property that indicates value is not a legal number" |
"isNaN(value)" | "returns true if value is NaN and false if not" |
"Math.min(x1 | x2 |
"Number.NEGATIVE_INFINITY" | "property that represents –Infinity" |
"Math.PI" | "returns the ratio of circle's area to the square of its radius" |
"Number.POSITIVE_INFINITY" | "property that represents Infinity" |
"Math.pow(x | y)" |
"Math.random()" | "returns a rndom number from 0 up to but not including 1" |
"Math.round(x)" | "returns number x rounded to nearest integer" |
"Math.sin(x)" | "returns sine of number x" |
"Math.sqrt(x)" | "returns the squre root of number x" |
"Math.SQRT1_2" | "returns square root of 1/2" |
"Math.SQRT2" | "returns the square root of 2" |
"Math.tan(x)" | "returns the tangent of angle x in radians" |
"X.toExponential(x)" | "returns number X in exponential notation with 0 <= x <= 20 digits after decimal" |
"X.toFixed(x)" | "returns number X as string with x digits after the decimal" |
"X.toPrecision(x)" | "returns number X formatted to x digits in length" |
"X.toString(radix)" | "converts to string and returns result as base of specific radix" |
"X.valueOf()" | "returns primative value of number X object" |
"str.charAt(index)" | "returns character at specified index in string" |
"str.charCodeAt(index)" | "returns unicode character at specified index in string" |
"str1.concat(str2...)" | "returns new string containing concatenated strings","Strings" |
"String.fromCharCode(n1,n2..) | "returns unicode values nx as string","Strings" |
"str.indexOf(searchvalue,start)" | "returns position of first occurrence of search value in string, optionally starting at index start from begging of string","Strings" |
"str.lastIndexOf(searchvalue, start)" | "returns position of first occurrence of search value in string, optionally starting at index start from end of string","Strings" |
"str.length" | "returns length property of string" |
"str.localeCompare(comparestring)" | "returns –1|0|1 for: str sorted before comparestring|strings are equal|str sorted after compare string" |
"str.match(regexp)" | "returns array object of matches for regexp on string" |
"str.replace(sreachvalue, newvalue)" | "searches a string for searchvaule(s) and replaces with new value","Strings" |
"str.search(searchvalue)" | "searches a string for searchvalue and returns index of first match found" |
"str.slice(start, end)" | "returns new string from start to end indexes, end is optional" |
"str.split(separator, limit)" | "searches for separator and returns array of strings optionally limited in items returned" |
"str.substr(start, length)" | "returns new string from specified start index, length is optional and limits characters returned" |
"str.substring(start, end)" | "returns new string from start to end not including end index, end is optional" |
"str.toLowerCase()" | "returns new string with all lower case letters" |
"str.toUpperCase()" | "returns new string with all uppercase characters" |
"str.toLocaleLowerCase()" | "returns new string with all lower case letters |
"str.toLocaleUpperCase()" | "returns new string with all uppercase characters |
"str.valueOf()" | "returns primitive value of string" |
"decodeURI(uri)" | "decodes uri" |
"decodeURIComponent(uri)" | "decodes uri component" |
"encodeURI(uri)" | "endoces special characters except: |
"encodeURIComponent(uri)" | "encodes special characters" |
"eval(string)" | "evaluates or executes an argument; only use in very special circumstances!!!" |
"isFinite(value)" | "returns t|f if value is a legal finite number |
"isNaN(value)" | "returns t|f if value is an illegal number |
"Number(object)" | "converts object argument to a number that represents the objects value" |
"parseFloat(string)" | "parses a string and returns a floating point number |
"parseInt(string, radix)" | "parses string and returns integer, radix is optional and sets numeral system to be used" |
"new String("string")" | "instantiates a new string object" |