background preloader

Javascript

Facebook Twitter

Code Playground. Create a new Fiddle - jsFiddle - Online Editor for the Web (JavaScript, MooTools, jQuery, Prototype, YUI, Glow and Dojo, HTML, CSS) JavaScript Lab - Tools - JS Regex Generator. About code. Found at: This article will give you an introduction to the world of . I'll start off with explaining what regular expressions are and introduce it's syntax, then some examples with varying complexity and last a list of tools which use . Concept A is a text pattern consisting of a combination of alphanumeric characters and special characters known as metacharacters.

You'll find that are used in three different ways: Regular text match, search and replace and splitting. Are often simply called regexps or RE, but for consistency I'll be referring to it with it's full name. Usage Now you're probably wondering why you should bother to learn . Developers can use them to parse text files, fix up code and other wonders. Actually I would go so far as to say it's a crime for a System Administrator not to have knowledge of . Quantifiers The contents of an expression is, as explained earlier, a combination of alphanumeric characters and metacharacters.

The Regulator. What the JavaScript RegExp API Got Wrong, & How to Fix It. Over the last few years, I've occasionally commented on JavaScript's RegExp API, syntax, and behavior on the ES-Discuss mailing list. Recently, JavaScript inventor Brendan Eich suggested that, in order to get more discussion going, I write up a list of regex changes to consider for future ECMAScript standards (or as he humorously put it, have my "95 [regex] theses nailed to the ES3 cathedral door"). I figured I'd give it a shot, but I'm going to split my response into a few parts. In this post, I'll be discussing issues with the current RegExp API and behavior. I'll be leaving aside new features that I'd like to see added, and merely suggesting ways to make existing capabilities better.

For a language as widely used as JavaScript, any realistic change proposal must strongly consider backward compatibility. Remove RegExp.prototype.lastIndex and replace it with an argument for start position JavaScript's lastIndex property serves too many purposes at once: Match iteration, using lastIndex: Jslibs - Project Hosting on Google Code. Présentation de Javascript (weebaz) Par Martin Depuis l’arrivée du web2.0 avec ses interfaces plus vivantes, le Javascript est de nouveau à la mode. Souvent utilisé avec Ajax il permet d’ajouter une couche d’ergonomie supplémentaire à l’interface utilisateur. Javascript s’est « professionnalisé » ces dernières années, au travers de frameworks qui apportent leur simplicité et standardisent les développements. Fini donc les bouts de code que chacun bidouillait dans son coin, aujourd’hui Javascript permet beaucoup plus que cela, encore faut il en connaitre un minimum sur le sujet, c’est ce que nous allons voir.

Photo de Frédéric de Villamil depuis Flickr Définitions Javascript ou JScript, suivant le navigateur, est un langage de script orienté objet ou plus exactement orienté prototype qui s’exécute côté client, sur la machine de l’internaute. Historique Javascript a été créé par Netscape en 1995 et mis en place dand Netscape Navigator dès 1996. Ou apprendre ? Documentation Questions / Réponses Outils Compressorrater. JavaScript HTML DOM Examples.

RegExp

JavaScript Cookbook. JavaScript Kit- Array Object. By default sorts an array alphabetically and ascending. By passing in an optional SortFunction, you can sort numerically and by other criteria as well. If SortFunction is defined, the array elements are sorted based on the relationship between each pair of elements within the array, "a" and "b", and your function's return value. The three possible return numbers are: <0 (less than 0), 0, or >0 (greater than 0): Less than 0: Sort "a" to be a lower index than "b" Zero: "a" and "b" should be considered equal, and no sorting performed.

Take a look at the following 3 distinct examples: //Sort Alphabetically and ascending: var myarray=["Bob","Bully","Amy"] myarray.sort() //Array now becomes ["Amy", "Bob", "Bully"] //Sort Alphabetically and descending: var myarray=["Bob","Bully","Amy"] myarray.sort() myarray.reverse() //Array now becomes ["Bully", "Bob", "Amy"] //Sort alphabetically using local collation rules: var myarray=["Bob","Bully","Amy"] myarray.sort()