Regular Expressions in JavaScript

Regular Expressions in JavaScript

Implemeneting regular expressions in Javascript: use str.replace(/[0-9]/gi,"a"); if th estr contains ab09, then the above function will return str=abaa Every regular expression has two properties:-

  1. g - It specifies that all the matching characters should be replaced. If g is not soecified ponly the first matching charcter will be replaced
  2. i - The i stands for ignore case
    i.e.if the regular experession is /[a-c]/i,"d"
    the the str="aAbBcC" will be transforemed to str= "dddddd"
Both the lowercase and upperecase characters will be transformed. If i is not psecified, on.ly the lowercase charcaters will be transformed. for example, if regularn expression in /[a-c]/, the the string will become "dAdBdC".

Comments

Popular posts from this blog

Parallel Database design, query processing

Laravel | PHP | Basics | Part 2

Apache Hadoop | Running MapReduce Jobs