Playing with Regular Expressions in JavaScript


Regular Expressions and Javascript = Win


At my work we were doing a project that was requiring to analyze the HTML locale and then execute different actions based on the location or language of the person. This javascript code uses Regular Expressions to find a match.

Regular expressions provide a great power to deal with strings, getting familiar with them will help you solve problems in an easier way.

The options I had were: Determine if the user belongs to:

  • US
  • Spain or Latin America
  • China
  • India
  • Asia
  • German speaking Europe, French speaking territories, Eastern Europe, Ex-URSS, The Netherlands
  • English, French and German Speaking territories

The idea of the script is to read the input (the locale entered) and determine if it fits any  criteria mentioned above.

Repo at github:


Download/Clone repository and open of your favorite web browser, this is pure HTML and Javascript, not server required.

I am originally from Venezuela but I have been living in Austin, Texas for the last 8 years. Web development has been part of my life for more than a decade; It started in the middle of my College years and by the time I got my bachelors degree in Electronics Engineering I was already known for delivering complex projects while delivering a good user experience.

Be first to comment