Regex
General
- https://en.wikipedia.org/wiki/Regular_expression - a sequence of characters that define a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. "find and replace"-like operations. The concept arose in the 1950s, when the American mathematician Stephen Kleene formalized the description of a regular language, and came into common use with the Unix text processing utilities ed, an editor, and grep, a filter.
In modern usage, "regular expressions" are often distinguished from the derived, but fundamentally distinct concepts of regex or regexp, which no longer describe a regular language. See below for details.
Regexps are so useful in computing that the various systems to specify regexps have evolved to provide both a basic and extended standard for the grammar and syntax; modern regexps heavily augment the standard. Regexp processors are found in several search engines, search and replace dialogs of several word processors and text editors, and in the command lines of text processing utilities, such as sed and AWK.
Many programming languages provide regexp capabilities, some built-in, for example Perl, JavaScript, Ruby, AWK, and Tcl, and others via a standard library, for example .NET languages, Java, Python, POSIX C and C++ (since C++11). Most other languages offer regexps via a library.
Types
POSIX
PCRE
See also Languages#Perl
- PCRE - Perl Compatible Regular Expressions - The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The PCRE library is free, even for building proprietary software.
- https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions
Guides
- http://qntm.org/files/re/re.html [1]
- http://regex.learncodethehardway.org/book/
- http://net.tutsplus.com/tutorials/javascript-ajax/you-dont-know-anything-about-regular-expressions/
- http://swtch.com/~rsc/regexp/regexp1.html
- http://stackoverflow.com/questions/16621738/d-less-efficient-than-0-9
- http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
- http://blog.mariusschulz.com/2014/06/03/why-using-in-regular-expressions-is-almost-never-what-you-actually-want [2]
Web tools
Search
- RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). Results update in real-time as you type. Roll over a match or expression for details. Save & share expressions with others. Explore the Library for help & examples. Undo & Redo with Ctrl-Z / Y. Search for & rate Community patterns.
- Debuggex - Online visual regex tester. JavaScript, Python, and PCRE.
- Build RegEx - A Regular Expression GUI.
- RegexPalregexpal — a JavaScript regular expression tester
- Automatic Generation of Regular Expressions from Examples - with examples and generation from csv
- Rubular - a Ruby regular expression editor
- Regexper - JS
- PCREck - a multi-dialect regular expression editor
- Regular Expression Analyzer - An online regular expression tool that helps analyzing regular expression structure.
- txt2re - regular expression generator (perl php python java javascript coldfusion c c++ ruby vb vbscript j# c# c++.net vb.net)
Search and replace
- regular expressions 101 — an online regex tester for javascript, php, pcre and python.
- My Regex Tester - PHP PCRE with search and replace
- REGex TESTER - ver. 1.5.3
- Regex Tester 2.0 alpha
Software
- regexxer is a nifty GUI search/replace tool featuring Perl-style regular expressions
- Hyperscan is a high-performance multiple regex matching library. It follows the regular expression syntax of the commonly-used libpcre library, yet functions as a standalone library with its own API written in C. Hyperscan uses hybrid automata techniques to allow simultaneous matching of large numbers (up to tens of thousands) of regular expressions, as well as matching of regular expressions across streams of data. [5]
sed
echo "test string oldWord yadayada" | sed 's/oldWord/newWord/g'
find . -name "*.html" -exec sed -i "s/oldWord/newWord/g" '{}' \; replace text in multiple files [7]
echo "<a href="index.html"><img src="logo.svg" id="site-logo"></a> <h1>Site Title</h1>" | sed 'N; s@</a>\ <h1>Site Title</h1>@\ <h1>Site Title</h1></a>@g' multiline replacement
awk
awk \'{print $NF;}\
ack
- ack - ack is a perl tool like grep for programmers
ag
- https://github.com/ggreer/the_silver_searcher - A code searching tool similar to ack with similar paramaters, with a focus on speed.
ag --hidden --ignore .git --ignore .winscp -l -g "" # lists all files
Library
- Regex Colorizer - JS library
Other
- Regex Crossword is a crossword puzzle game, where the crossword clues are defined using regular expressions. [11] [12]