🌐
LMU
cs.lmu.edu › ~ray › notes › regex
Regular Expressions
Okay, in many programming languages, ... they are capable of matching goes way beyond what regular expressions from language theory can describe. Rather than start with technical details, we’ll start with a bunch of examples....
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Regular_expressions
Regular expressions - JavaScript | MDN
A regular expression pattern is composed of simple characters, such as /abc/, or a combination of simple and special characters, such as /ab*c/ or /Chapter (\d+)\.\d*/. The last example includes parentheses, which are used as a memory device.
Discussions

regex - Regular Expressions: Is there an AND operator? - Stack Overflow
You can do that with a regular expression but probably you'll want to some else. For example use several regexp and combine them in a if clause. More on stackoverflow.com
🌐 stackoverflow.com
Explain Like I'm 5: Regular Expressions
IMHO making eyes glaze over is what regular expressions excels at. I hate it with a passion. That being said, it is a powerful, useful tool for parsing text. The key thing that triggered my understanding of regex is that all characters/arguments/etc are positional. They aren't flags, triggers, or what have you, they match the literal of what they represent at that position in your regex string. So, a quick example. I use this in a script of mine for grabbing a version string. "^[0-9]+\.[0-9]+\.[0-9]+" It literally matches start of line, one or more of the digits of zero through nine, a period, one or more digits of zero through nine, a period, one or more digits of zero through nine The carat ^ matches the literal start of line. [0-9] is a kind of specified wildcard, it says the character here can match any digit zero through nine. + is a special character that extends the previous argument in the string ([0-9]) and says to match it at least once and then for as many times as it positively matches. \ is the escape character, it says 'treat the following argument as a string literal, not as a special character'. . since it was escaped by \, we are looking for a literal period/decimal-point. From there, the sequence repeats. It will match any of these, and more: 1.0.5, 15.154.42, 0.0.5 I'm not on my computer with my scripts so I don't have the actual function it's used in handy. I really struggled hard to wrap my head around regular expressions, and I really hope this helps. If you want, I'll come back later when I have access to my scripts and post some actual in-use functions. More on reddit.com
🌐 r/learnpython
43
65
July 3, 2014
What exactly is regex used for?
Typically it's used to match patterns in text. To either detect a pattern, or extract data from a string that follows a particular pattern. More on reddit.com
🌐 r/learnprogramming
7
2
October 20, 2022
Regular Expressions, aka Regex, examples

I took a short look and jumped around a bit, and I think this is lacking enough explanation to help beginners, and also lacks enough depth to help experts. I'm not sure who would benefit from this.

For example:

.1. Using the Regex Test Method

var result = regex.test(string);

You show that running your sample code returns true. A beginner might want to know what it is doing -- in this case, testing if the literal string the is present in the search string, and returning true because it is there. I am not sure that this would be obvious to a total beginner. Also, you don't explain that the regular expression is enclosed in /, so maybe a beginner can misinterpret.

.4. Ignore Case While Matching

You don't explain that javascript regexes have flags or that they are placed at the back of the object, you just throw in the 'i' flag in there. I'm not sure that this would be sufficiently obvious to a total beginner.

.19. Match All Letters and Numbers

var regex = /\w/g;

\w also matches the underscore character _ in addition to letters and numbers. I think you'd want the old fashioned [a-zA-Z0-9] to match all letters and numbers without extra characters.

.26. Specify Upper and Lower Number of Matches

var regex = /Oh{3,6} no/;

This doesn't change the number of matches, the {} quantifier changes the number of letters allowed in a single match.

Overall, this tutorial seems a mix of how javascript handles regular expressions and regex syntax itself. Also, you are inconsistent with ending statements with a ;. The first 4 regexes aren't ended with a ;, the rest are.

More on reddit.com
🌐 r/regex
2
6
August 12, 2016
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › standard › base-types › regular-expression-language-quick-reference
Regular Expression Language - Quick Reference - .NET | Microsoft Learn
For more information about inline and RegexOptions options, see the article Regular Expression Options. ... By using the miscellaneous construct (?imnsx-imnsx), where a minus sign (-) before an option or set of options turns those options off. For example, (?i-mn) turns case-insensitive matching ...
🌐
Google Support
support.google.com › administrators › gmail › advanced › examples of regular expressions
Examples of regular expressions
Each example includes the type of text to match, one or more regular expressions that match that text, and notes that explain the use of the special characters and formatting.
🌐
NTU Singapore
www3.ntu.edu.sg › home › ehchua › programming › howto › Regexe.html
Regular Expression (Regex) Tutorial
For examples, \+ matches "+"; \[ matches "["; and \. matches ".". Regex also recognizes common escape sequences such as \n for newline, \t for tab, \r for carriage-return, \nnn for a up to 3-digit octal number, \xhh for a two-digit hex code, \uhhhh for a 4-digit Unicode, \uhhhhhhhh for a 8-digit Unicode. $ python3 >>> import re # Need module 're' for regular expression # Try find: re.findall(regexStr, inStr) -> matchedStrList # r'...' denotes raw strings which ignore escape code, i.e., r'\n' is '\'+'n' >>> re.findall(r'a', 'abcabc') ['a', 'a'] >>> re.findall(r'=', 'abc=abc') # '=' is not a special regex character ['='] >>> re.findall(r'\.', 'abc.com') # '.' is a special regex character, need regex escape sequence ['.'] >>> re.findall('\\.', 'abc.com') # You need to write \\ for \ in regular Python string ['.']
🌐
Python documentation
docs.python.org › 3 › library › re.html
re — Regular expression operations
5 days ago - Special characters either stand for classes of ordinary characters, or affect how the regular expressions around them are interpreted. Repetition operators or quantifiers (*, +, ?, {m,n}, etc) cannot be directly nested. This avoids ambiguity with the non-greedy modifier suffix ?, and with other modifiers in other implementations. To apply a second repetition to an inner repetition, parentheses may be used. For example, the expression (?:a{6})* matches any multiple of six 'a' characters.
🌐
Medium
ltramos7.medium.com › regular-expressions-regexp-3c4212a20928
Regular Expressions (Regexp). Crazy looking, but crazy useful. | by Linda Ramos | Medium
October 5, 2020 - I recently came across Regular Expressions, also referred to as regexp. Here is an example: [a-zA-Z0–9_.+-]+@[a-zA-Z0–9-]+\.[a-zA-Z0–9-.]+. That seems like a hot mess and incredibly intimidating. However, if you enjoy coding, especially the puzzle solving aspect to it, you might enjoy the crazy mess above.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › write-regular-expressions
Regex Tutorial - How to write Regular Expressions - GeeksforGeeks
Example: Regular expression .* will tell the computer that any character can be used any number of times.
Published   December 22, 2025
🌐
R for Data Science
r4ds.hadley.nz › regexps.html
15 Regular expressions – R for Data Science (2e)
This is a useful technique whenever you’re dealing with logical combinations, particularly those involving “and” or “not”. For example, imagine if you want to find all words that contain “a” and “b”. There’s no “and” operator built in to regular expressions so we have to tackle it by looking for all words that contain an “a” followed by a “b”, or a “b” followed by an “a”:
🌐
Rexegg
rexegg.com › regex-quickstart.php
Regex Cheat Sheet
Regular Expressions Syntax Reference. Includes tables showing syntax, examples and matches.
🌐
RegexOne
regexone.com
RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs
RegexOne provides a set of interactive lessons and exercises to help you learn regular expressions
🌐
Python documentation
docs.python.org › 3 › howto › regex.html
Regular Expression HOWTO — Python 3.14.3 documentation
For example, [\s,.] is a character class that will match any whitespace character, or ',' or '.'. The final metacharacter in this section is .. It matches anything except a newline character, and there’s an alternate mode (re.DOTALL) where it will match even a newline. . is often used where you want to match “any character”. Being able to match varying sets of characters is the first thing regular expressions can do that isn’t already possible with the methods available on strings.
🌐
RegExr
regexr.com
RegExr: Learn, Build, & Test RegEx
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp). Supports JavaScript & PHP/PCRE RegEx. Results update in real-time as you type. Roll over a match or expression for details. Validate patterns with suites of Tests. Save & share expressions with others. Use Tools to explore your results. Full RegEx Reference with help & examples...
🌐
IBM
ibm.com › docs › en › nsm › 61.1
Regular expression examples
We cannot provide a description for this page right now
🌐
W3Schools
w3schools.com › js › js_regexp.asp
W3Schools.com
In a regular expression an alternation is denoted with a vertical line character |.
Top answer
1 of 16
525

Use a non-consuming regular expression.

The typical (i.e. Perl/Java) notation is:

(?=expr)

This means "match expr but after that continue matching at the original match-point."

You can do as many of these as you want, and this will be an "and." Example:

(?=match this expression)(?=match this too)(?=oh, and this)

You can even add capture groups inside the non-consuming expressions if you need to save some of the data therein.

2 of 16
490

You need to use lookahead as some of the other responders have said, but the lookahead has to account for other characters between its target word and the current match position. For example:

(?=.*word1)(?=.*word2)(?=.*word3)

The .* in the first lookahead lets it match however many characters it needs to before it gets to "word1". Then the match position is reset and the second lookahead seeks out "word2". Reset again, and the final part matches "word3"; since it's the last word you're checking for, it isn't necessary that it be in a lookahead, but it doesn't hurt.

In order to match a whole paragraph, you need to anchor the regex at both ends and add a final .* to consume the remaining characters. Using Perl-style notation, that would be:

/^(?=.*word1)(?=.*word2)(?=.*word3).*$/m

The 'm' modifier is for multline mode; it lets the ^ and $ match at paragraph boundaries ("line boundaries" in regex-speak). It's essential in this case that you not use the 's' modifier, which lets the dot metacharacter match newlines as well as all other characters.

Finally, you want to make sure you're matching whole words and not just fragments of longer words, so you need to add word boundaries:

/^(?=.*\bword1\b)(?=.*\bword2\b)(?=.*\bword3\b).*$/m
🌐
Wikipedia
en.wikipedia.org › wiki › Regular_expression
Regular expression - Wikipedia
5 days ago - For example, . is a very general pattern, [a-z] (match all lowercase letters from 'a' to 'z') is less general and b is a precise pattern (matches just 'b'). The metacharacter syntax is designed specifically to represent prescribed targets in a concise and flexible way to direct the automation of text processing of a variety of input data, in a form easy to type using a standard ASCII keyboard. A very simple case of a regular expression in this syntax is to locate a word spelled two different ways in a text editor; for example, the regular expression seriali[sz]e matches both "serialise" and "serialize".
🌐
NetApp
docs.netapp.com › us-en › oncommand-insight › config-admin › regular-expression-examples.html
Regular expression examples
September 9, 2022 - The following regular expression would do this: .*?_([a-zA-Z0-9]+)_([a-zA-Z0-9]+)_([a-zA-Z0-9]+)_.* Because there are three sets of parentheses, the variables \1, \2 and \3 would be populated. You could then use the following format to receive output in your preferred format: ... The hyphens between the variables provide an example of constant text that is inserted in the formatted output.
🌐
Envato Tuts+
code.tutsplus.com › home › coding fundamentals › regular expressions
9 Regular Expressions You Should Know | Envato Tuts+
October 23, 2022 - With a regular expression, you can easily match characters, words, or patterns within text. A really basic example would be the regex /c*t/—this would match "cat", "cot", or "cut", but not "pat" or "but".
🌐
MIT
web.mit.edu › gnu › doc › html › regex_3.html
Regex - Common Operators
The `.' (period) character represents this operator. For example, `a.b' matches any three-character string beginning with `a' and ending with `b'. This operator concatenates two regular expressions a and b. No character represents this operator; you simply put b after a.