Tags » Regex

The Stack Overflow Regular Expression FAQ, which I maintain and contribute to, is now integrated into Stack Overflow’s ask-a-question auto-tips, when it detects the question might be regex related. 19 more words


Regex escape of special characters in JavaScript/NodeJs

Escape your regex containing \ ^ $ * + ? . ( ) | { } [ ] like so:

function escapeRegExp(str) {

return str.replace(/[-\[\]\/\{\}\(\)\*\+\?.\\^\$\|]/g, “\$&”)

25 more words

Regular Expressions (RegEx) - Wildcard Pattern Find and Replace - Visual Studio

On a recent project where I used ILSpy and Reflector.NET to extract source code from an old DLL, I ended up with some thousands of slightly incorrect things.   572 more words


Removing empty lines using `sed`

Consider this snippet from a file:






It’s a list of integers (the full file has 122 of them), but the delimiter is three newline characters. 361 more words


Aladore Regex

In earlier posts, I mentioned using advanced features of find & replace to do some automated editing of the HTML tags in the text.  Let me give you another example to show how useful some clever find & replace can be! 898 more words


"Regular Expression Matching" with Java

Since I have spent a lot of time in order to solve this problem neatly, I decide to invest more time to explain it in detail. 283 more words


Regex - using groups effectively

What are regex groups?

I suppose you know what a group (generally) is and that you have an intuitive understanding of why people sometimes group things. 1,398 more words