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
- 1Javascript Trim Showdown2 people · 3 points · first shared 2008 · discussion on HN
- 2What the JavaScript RegExp API Got Wrong, & How to Fix It2 people · 2 points · first shared 2010 · discussion on HN
- 3Regex Legends: The People Behind the Magic1 people · 35 points · first shared 2021 · 9 comments on HN
- 4JS faster replacement for elem.innerHTML1 people · 4 points · first shared 2012 · discussion on HN
- 5Levels of JavaScript Regex Knowledge1 people · 4 points · first shared 2010 · discussion on HN
- 6Creating BNF-style grammatical regular expressions in JavaScript1 people · 3 points · first shared 2012 · discussion on HN
- 7Solving Linear Equation with Regexes1 people · 3 points · first shared 2008 · discussion on HN
- 8Regex Syntax Highlighter1 people · 2 points · first shared 2010 · discussion on HN
- 910 Reasons to Learn and Use Regular Expressions1 people · 2 points · first shared 2008 · discussion on HN
- 10Matching quoted strings with regexes1 people · 1 points · first shared 2012 · discussion on HN
- 11Remove Nested Patterns with One Line of JavaScript1 people · 1 points · first shared 2010 · discussion on HN
- 12Cross browser1 people · first shared 2011
- 13Comment page 11 people · first shared 2010
- 14Parseuri1 people · first shared 2012
- 15Validate phone number1 people · first shared 2012
What HN people wrote when they linked it
mhotchen · 2024-08-08
https://www.regular-expressions.info/
and
https://blog.stevenlevithan.com/
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.
DanBC · 2012-03-12
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.