S

Steven Levithan

blog.stevenlevithan.com · Personal blog · on HN since 2008

Steven Levithan writes about JavaScript and regular expressions, including trim performance, the RegExp API, and parsing tricks.

What HN saysHN links it as a regex resource, especially his parseUri script, JavaScript trim benchmarks, and a phone number validation post.
18HN people shared it
6linked it in comments
12stories submitted
60story points
2 years agolast shared
2008people per year2026

Most-shared posts

  1. 1
    Javascript Trim Showdown
    2 people · 3 points · first shared 2008 · discussion on HN
  2. 2
  3. 3
    Regex Legends: The People Behind the Magic
    1 people · 35 points · first shared 2021 · 9 comments on HN
  4. 4
    JS faster replacement for elem.innerHTML
    1 people · 4 points · first shared 2012 · discussion on HN
  5. 5
    Levels of JavaScript Regex Knowledge
    1 people · 4 points · first shared 2010 · discussion on HN
  6. 6
  7. 7
    Solving Linear Equation with Regexes
    1 people · 3 points · first shared 2008 · discussion on HN
  8. 8
    Regex Syntax Highlighter
    1 people · 2 points · first shared 2010 · discussion on HN
  9. 9
    10 Reasons to Learn and Use Regular Expressions
    1 people · 2 points · first shared 2008 · discussion on HN
  10. 10
    Matching quoted strings with regexes
    1 people · 1 points · first shared 2012 · discussion on HN
  11. 11
    Remove Nested Patterns with One Line of JavaScript
    1 people · 1 points · first shared 2010 · discussion on HN
  12. 12
    Cross browser
    1 people · first shared 2011
  13. 13
    Comment page 1
    1 people · first shared 2010
  14. 14
    Parseuri
    1 people · first shared 2012
  15. 15
    Validate phone number
    1 people · first shared 2012

What HN people wrote when they linked it

BinaryBullet · 2012-10-28
As others have suggested, jQuery is overkill for this. The best lightweight js library I've found/used in the past is parseUri: http://blog.stevenlevithan.com/archives/parseuri Obviously, if you only need to analyze the current URL, you can use window/document.location, but there are times when you want to parse a URI for a page you aren't on. For instance, if you are analyzing har data, and want to break URI "components" into columns so they are sortable.
laughinghan · 2011-01-09
Of course it's not the only way, have you seen Google's homepage? Also, JScript is actually surprising good and is nothing like the DOM or CSS, AFAIK the only known bugs are Named Function Expressions being parsed as Function Declarations (http://kangax.github.com/nfe/#jscript-bugs), and a couple RegExp bugs (http://blog.stevenlevithan.com/category/cross-browser). I suppose if you count DOM bugs, like the memory leak, that's a problem. That's where jQuery is amazingly helpful(and presumably other libraries like it). Considering Raphael is as slow as excanvas in IE (but much faster in other browsers), it's probably IE's fault, not excanvases.
niyazpk · 2010-10-16
Kudos! Looks like the performance improvements are aided by the new native methods in the latest browsers. I wonder at what point they will stop supporting older browsers like IE6. Here is the article on different JavaScript trim methods: http://blog.stevenlevithan.com/archives/faster-trim-javascript
skennedy · 2010-02-10
Someone who offers three solutions to mimic lookbehind's in Javascript: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript/co… Also, there seems to also be a lot of support for leveraging PHP's regex functionality on the server-side to accomplish this.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close