Skip to content


Subversion checkout URL

You can clone with
Download ZIP
100644 52 lines (35 sloc) 2.3 KB
2cb9d7a Fix readme
Alok Menghrajani authored
1 ![]( "")
e6d2fc9 Fixing readme.
Alok Menghrajani authored
db2e62f Initial readme.
Alok Menghrajani authored
3 Introduction
4 ------------
5 Regular Expressions are notoriously hard to get right. When you are writing a new expression, it
6 is hard for reviewers to read & assert with confidence that the expression is correct. Tweaking
7 existing expressions can often lead to unintended consequences.
896ebd6 After a long night of hacking...
Alok Menghrajani authored
db2e62f Initial readme.
Alok Menghrajani authored
9 RiskyBird tries to mitigate this by offering a set of tools for software engineers:
11 1. A parser: guarantees the expression is well formed.
12 2. A pretty printer: helps interpret the regular expression.
13 3. A lint engine: catches common mistakes.
14 4. A unittest engine: prevents future mishapes.
15 5. A collaboration platform: reviewers can add tests and provide feedback.
5d267f9 Rename all the files to riskybird.
Alok Menghrajani authored
18 Why RiskyBird
19 -------------
20 We love AngryBirds and we wanted a name that starts with R.
23 See it in action
24 ----------------
25 When ready, this code will be running on:
db2e62f Initial readme.
Alok Menghrajani authored
28 Some notes
29 ----------
30 I haven't found a nice place to put these, so leaving these notes here.
32 Here are some tips to help you write better regular expressions:
34 1. Is the language regular(*)? We have often tried to write regular expressions for languages which are not regular! This
35 always leads to issues down the road. If the language is not regular, you will need to use a Lexer/Grammar.
37 * regular expression engines actually implement some features which cannot be described by regular languages (in the
38 formal sense), but you get my point.
40 2. Can I use a less powerful but faster library (i.e. pattern matching instead of regular expressions)?
42 3. Am I trying to match a URI (or part of one)? It is **extreemly hard** to get URI parsing right, and different
43 browsers interpret URIs differently. The only way to get this right is to split the URI into parts (protocol,
44 user, password, domain, port, path, etc.), run the desired checks on the parts and then rebuilt a new URI with
45 the proper escaping applied to each part. Again, we have libraries to do this!
2cb9d7a Fix readme
Alok Menghrajani authored
47 * If you aren't convinced this is required, go read the browser security handbook or the Tangled Web.
db2e62f Initial readme.
Alok Menghrajani authored
49 4. Don't be lazy. If you know your expression should match the beginning of a string put the ^ anchor. If you
50 are expecting a ".", use \. instead of the dot metacharacter. Use non capturing groups when you don't need
51 to capture a group. Etc.
Something went wrong with that request. Please try again.