regular expressions

regex

Parsing Html The Cthulhu Way

Among programmers of any experience, it is generally regarded as A Bad Ideatm to attempt to parse HTML with regular expressions. How bad of an idea? It apparently drove one Stack Overflow user to the brink of madness: You can't parse [X]HTML with regex. Because HTML can&

By Jeff Atwood ·
Comments

regular expressions

Testing With "The Force"

Markdown was one of the humane markup languages that we evaluated and adopted for Stack Overflow. I've been pretty happy with it, overall. So much so that I wanted to implement a tiny, lightweight subset of Markdown for comments as well. I settled on these three commonly used

By Jeff Atwood ·
Comments

programming languages

Regular Expressions for Regular Programmers

If you've followed my blog for any length of time, you know that I am a total regular expression fanboy. It's almost embarrassing how much I love the damn things. I'm pretty sure my teammates roll their eyes every time they see yet another

By Jeff Atwood ·
Comments

regular expressions

Regular Expressions: Now You Have Two Problems

I love regular expressions. No, I'm not sure you understand: I really love regular expressions. You may find it a little odd that a hack who grew up using a language with the ain't keyword would fall so head over heels in love with something as

By Jeff Atwood ·
Comments

regular expressions

We Don't Use Software That Costs Money Here

Whenever the regular expression topic comes up, I unashamedly recommend the best tool on the market for parsing and building regular expressions -- RegexBuddy. But there's one tiny problem. RegexBuddy costs money. I've always encountered vague resistance when recommending commercial tools that I considered best of

By Jeff Atwood ·
Comments

programming languages

Embracing Languages Inside Languages

Martin Fowler loosely defines a fluent interface thusly: "The more the use of the API has that language like flow, the more fluent it is." If you detect a whiff of skepticism here, you're right: I've never seen this work. Computer languages aren'

By Jeff Atwood ·
Comments

regular expressions

Shortening Long File Paths

We're working on a little shell utility that displays paths in a menu. Some of these paths can get rather long, so I cooked up this little regular expression to shorten them. It's a replacement, so you call it like this: static string PathShortener(string path)

By Jeff Atwood ·
Comments

regex

The Visual Studio IDE and Regular Expressions

The Visual Studio IDE supports searching and replacing with regular expressions, right? Sure it does. It's right there in grey and black in the find and replace dialog. Just tick the "use Regular expressions" checkbox and we're off to the races. However, you'

By Jeff Atwood ·
Comments

html cleaning

Cleaning Word's Nasty HTML

I recently wrote a Word 2003 document that I later turned into a blog post [http://blogs.vertigosoftware.com/jatwood/archive/2006/01/06/Guidelines_and_Tips_for_Pure_CSS_Layouts.aspx] . The transition between Word doc and HTML presented some problems. Word offers two HTML options in its save

By Jeff Atwood ·
Comments

regex

Excluding Matches With Regular Expressions

Here's an interesting regex problem [http://techreport.com/forums/viewtopic.php?t=34782]: > I seem to have stumbled upon a puzzle that evidently is not new, but for which no (simple) solution has yet been found. I am trying to find a way to exclude an entire

By Jeff Atwood ·
Comments

parsing

Parsing: Beyond Regex

I’ve blogged ad nauseam about how much I love Regular Expressions, but even the mighty regular expression has limits. As noted in Daniel Cazzulini’s blog: A full-blown programming language cannot be parsed with regular expressions. But given the limited number of programming languages (successful ones, let’s say)

By Jeff Atwood ·
Comments

.net

The One Trillion Dollar Development Pyramid

Kit George is the program manager for the .NET Base Class Library team. Kit recently posted an entry on the BCL blog describing a solution to a customer problem: We recently got asked this question by a customer: “In C#, how do I ensure that a string entered into a

By Jeff Atwood ·
Comments