Rectangle 27 610

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 610

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 609

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 609

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 598

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 595

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 595

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 594

The Stack Overflow Regular Expressions FAQ

*?
*+
+?
++
{n,m}
{n,}
{n}
[...]
[^...]
[^]
[\w-[\d]]
[a-z-[qz]]
[\w&&[^\d]]
[[:alpha:]]
[^\\D2]
[^[^0-9]2]
[^2[^0-9]]
\d
\D
\w
\W
\s
\S
\p{L}, \P{L}
\h
\t
\H
\V
\v
\e
\b
\B
\G
Matcher
(...)
(?:)
\1
$1
(?P<group_name>regexp)
(?>)
(?|)
(?P<groupname>regex)
(?<groupname>regex)
(?=...)
(?!...)
(?<=...)
(?<!...)
{0,n}
\K
[.]
(*PRUNE)
(*SKIP)
(*FAIL)
(*F)
(*BSR_ANYCRLF)
  • Recursion (php and perl): (?R), (?0) and (?1), (?-1), (?&groupname)
java.util.regex.Matcher
matches()
  • find()): A match may be anywhere in the input string (substrings)
lookingAt()
  • The only java.lang.String functions that accept regular expressions: matches(s), replaceAll(s,s), replaceFirst(s,s), split(s), split(s,i)
preg_match
search
match
regexp
  • Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. (blog post written by Stack Overflow's founder)*

Examples of regex that can cause regex engine to fail

  • Debuggex (Also has a repository of useful regexes) javascript, python, pcre
freeformatter.com
regex.larsolavtorvik.com

I don't understand this treatise. While it is (and has) a functional value and good links, nobody that is a beginner will ever understand anything past the first line. Therefore it is useless as an instructional tool. It's title Reference - What does this regex mean? does not tell you what any particular regex means. It is a mish-mash of links.. an overwhelming blend if you will, of the universe of regex constructs from different engines. To make things worse, some people mark regex questions as a direct duplicate of this question. It's sad ..

@sln, I think the correct usage would be to look up the answer to a newly asked regex question in this reference, find the linked Q&A that really does answer the new question and is a dupe, mark the new question as a dupe of that post, and add a comment linking to this page.

@Wildcard - This page is/should definitely be for comment linking after some introductory, general info. But, I've seen it used inappropriately as a direct duplicate too many times.

@sln A rare example of when you should shoot the messenger.

Reference - What does this regex mean? - Stack Overflow

regex
Rectangle 27 10

If you are able to detect columns names from SQL injections, it means it is violatable.

It also means you could easily brute force attack a webpage and detect all the structure, users, export the data, etc... So yeah, site IS vulnerable and it goes much farther than "My data is public so i don't care"...

The hacker could find a way to insert data into the database, create some phishing, steal data from XSS attacks that he inserts into the database. There are tons of reasons to take this seriously. SQL injection doesn't mean that the hacker can only read your data, it can lead to serious compromises...

Thanks Mathieu, actually, this database only stores NEWS, not vital info, but would be very bad if editable. That answer was very enlightening, if you don't mind i'll use your words as mine :P , i'll give you the points you deserve.

php - Sql injection vulnerability - Stack Overflow

php sql security sql-injection
Rectangle 27 10

If you are able to detect columns names from SQL injections, it means it is violatable.

It also means you could easily brute force attack a webpage and detect all the structure, users, export the data, etc... So yeah, site IS vulnerable and it goes much farther than "My data is public so i don't care"...

The hacker could find a way to insert data into the database, create some phishing, steal data from XSS attacks that he inserts into the database. There are tons of reasons to take this seriously. SQL injection doesn't mean that the hacker can only read your data, it can lead to serious compromises...

Thanks Mathieu, actually, this database only stores NEWS, not vital info, but would be very bad if editable. That answer was very enlightening, if you don't mind i'll use your words as mine :P , i'll give you the points you deserve.

php - Sql injection vulnerability - Stack Overflow

php sql security sql-injection
Rectangle 27 8

The usual way to transition sites away from magic_quotes_gpc is to add a wrapper function:

function m($s) {
    if (get_magic_quotes_gpc())
        $s= stripslashes($s);
    return mysql_real_escape_string($s);
}

mysql_query("SELECT * FROM foo WHERE bar='".m($_GET['baz'])."'");

This will fix the problem of addslashes not being character-set-aware that can cause it to be vulnerable in some cases, and will generally make the code continue to work as before.

However in the long term relying on input-escaping is unsustainable, as it will multiply slashes into input strings you are not inserting into the database, and fail to escape strings you're inserting into the database from other sources. This is the real reason magic_quotes_gpc is the wrong thing: it's applying an output-stage encoding to the input stage.

So add the wrapper function and then slowly go through updating all the SQL interpolations to use it. When you've got them all you can turn the magic quotes off.

And why it is so bad having all values escaped in input-stage, of course, if you are aware of the fact? In my opinion magic_quotes_gpc is bad only because you are not exactly aware of it and only because of this. Original questioner mentioned thousands of code lines he will have to patch, I guess he wouldn't ask if he could afford the change you've proposed. Why not to filter all input arguments ($_GET, $_POST, $_REQUEST, etc) at the entrance to the main code?

Because at the input stage you do not necessarily know whether one particular input is going to go into an SQL string literal, be output directly to HTML, dropped into a sent e-mail, compared against another string fetched from the database, used in a LIKE query, or many of these things or others. To make it work correctly you would have to remember what strings have SQL escapes in them and add an unescape for each operation that isn't putting each property into an SQL string literal. This is way, way messier than just escaping when you do an SQL query, which at least stays in one place.

magic_quotes_gpc is also bad because addslashes is totally not the right function for SQL-escaping: in MySQL there is the multibyte encoding issue, and in other databases that use ANSI standard string literals instead of backslashes it'll do nothing.

sql injection - PHP magic_quotes_gpc vulnerability - Stack Overflow

php sql-injection exploit magic-quotes
Rectangle 27 61

PHP

Agreeing/expanding what has already been said, I don't think FastCGI will solve the problem.

Each request into Apache will use one worker thread until the request completes, which may be a long time for COMET requests.

This article on Ajaxian mentions using COMET on Apache, and that it is difficult. The problem isn't specific to PHP, and applies to any back-end CGI module you may want to use on Apache.

The suggested solution was to use the 'event' MPM module which changes the way requests are dispatched to worker threads.

This MPM tries to fix the 'keep alive problem' in HTTP. After a client completes the first request, the client can keep the connection open, and send further requests using the same socket. This can save signifigant overhead in creating TCP connections. However, Apache traditionally keeps an entire child process/thread waiting for data from the client, which brings its own disadvantages. To solve this problem, this MPM uses a dedicated thread to handle both the Listening sockets, and all sockets that are in a Keep Alive state.

Unfortunately, that doesn't work either, because it will only 'snooze' after a request is complete, waiting for a new request from the client.

Now, considering the other side of the problem, even if you resolve the issue with holding up one thread per comet request, you will still need one PHP thread per request - this is why FastCGI won't help.

You need something like Continuations which allow the comet requests to be resumed when the event they are triggered by is observed. AFAIK, this isn't something that's possible in PHP. I've only seen it in Java - see the Apache Tomcat server.

There's an article here about using a load balancer (HAProxy) to allow you to run both an apache server and a comet-enabled server (e.g. jetty, tomcat for Java) on port 80 of the same server.

+1 because Apache/PHP are not good options for scaling out a comet solution. Options for PHP users are 1) as you mentioned, crazy configurations of additional servers and proxies or 2) using a SaaS solution and offloading the comet stuff via something like WebSync On-Demand.

This is wrong in several aspects. If one wants to leave the one-thread-per-user method, it can be easily achieved by removing Apache as an intermediary and let PHP handle these requests. Of course, Apache works better at serving content, so I would run this apache-less PHP sever on a subdomain that does not serve any content.

@MikeHouston What about trying comet with php in IIS.?

@ravz, there's some stuff here about IIS and comet: stackoverflow.com/questions/1898848/comet-programming-in-iis, but I suspect the fast-cgi PHP module has the same limitations as with apache. It mentions a single threaded environment here: microsoft.com/web/platform/phponwindows.aspx - I don't use Windows servers myself, so I'm not sure about the threading model.

Using comet with PHP? - Stack Overflow

php comet
Rectangle 27 61

PHP

Agreeing/expanding what has already been said, I don't think FastCGI will solve the problem.

Each request into Apache will use one worker thread until the request completes, which may be a long time for COMET requests.

This article on Ajaxian mentions using COMET on Apache, and that it is difficult. The problem isn't specific to PHP, and applies to any back-end CGI module you may want to use on Apache.

The suggested solution was to use the 'event' MPM module which changes the way requests are dispatched to worker threads.

This MPM tries to fix the 'keep alive problem' in HTTP. After a client completes the first request, the client can keep the connection open, and send further requests using the same socket. This can save signifigant overhead in creating TCP connections. However, Apache traditionally keeps an entire child process/thread waiting for data from the client, which brings its own disadvantages. To solve this problem, this MPM uses a dedicated thread to handle both the Listening sockets, and all sockets that are in a Keep Alive state.

Unfortunately, that doesn't work either, because it will only 'snooze' after a request is complete, waiting for a new request from the client.

Now, considering the other side of the problem, even if you resolve the issue with holding up one thread per comet request, you will still need one PHP thread per request - this is why FastCGI won't help.

You need something like Continuations which allow the comet requests to be resumed when the event they are triggered by is observed. AFAIK, this isn't something that's possible in PHP. I've only seen it in Java - see the Apache Tomcat server.

There's an article here about using a load balancer (HAProxy) to allow you to run both an apache server and a comet-enabled server (e.g. jetty, tomcat for Java) on port 80 of the same server.

+1 because Apache/PHP are not good options for scaling out a comet solution. Options for PHP users are 1) as you mentioned, crazy configurations of additional servers and proxies or 2) using a SaaS solution and offloading the comet stuff via something like WebSync On-Demand.

This is wrong in several aspects. If one wants to leave the one-thread-per-user method, it can be easily achieved by removing Apache as an intermediary and let PHP handle these requests. Of course, Apache works better at serving content, so I would run this apache-less PHP sever on a subdomain that does not serve any content.

@MikeHouston What about trying comet with php in IIS.?

@ravz, there's some stuff here about IIS and comet: stackoverflow.com/questions/1898848/comet-programming-in-iis, but I suspect the fast-cgi PHP module has the same limitations as with apache. It mentions a single threaded environment here: microsoft.com/web/platform/phponwindows.aspx - I don't use Windows servers myself, so I'm not sure about the threading model.

Using comet with PHP? - Stack Overflow

php comet
Rectangle 27 61

PHP

Agreeing/expanding what has already been said, I don't think FastCGI will solve the problem.

Each request into Apache will use one worker thread until the request completes, which may be a long time for COMET requests.

This article on Ajaxian mentions using COMET on Apache, and that it is difficult. The problem isn't specific to PHP, and applies to any back-end CGI module you may want to use on Apache.

The suggested solution was to use the 'event' MPM module which changes the way requests are dispatched to worker threads.

This MPM tries to fix the 'keep alive problem' in HTTP. After a client completes the first request, the client can keep the connection open, and send further requests using the same socket. This can save signifigant overhead in creating TCP connections. However, Apache traditionally keeps an entire child process/thread waiting for data from the client, which brings its own disadvantages. To solve this problem, this MPM uses a dedicated thread to handle both the Listening sockets, and all sockets that are in a Keep Alive state.

Unfortunately, that doesn't work either, because it will only 'snooze' after a request is complete, waiting for a new request from the client.

Now, considering the other side of the problem, even if you resolve the issue with holding up one thread per comet request, you will still need one PHP thread per request - this is why FastCGI won't help.

You need something like Continuations which allow the comet requests to be resumed when the event they are triggered by is observed. AFAIK, this isn't something that's possible in PHP. I've only seen it in Java - see the Apache Tomcat server.

There's an article here about using a load balancer (HAProxy) to allow you to run both an apache server and a comet-enabled server (e.g. jetty, tomcat for Java) on port 80 of the same server.

+1 because Apache/PHP are not good options for scaling out a comet solution. Options for PHP users are 1) as you mentioned, crazy configurations of additional servers and proxies or 2) using a SaaS solution and offloading the comet stuff via something like WebSync On-Demand.

This is wrong in several aspects. If one wants to leave the one-thread-per-user method, it can be easily achieved by removing Apache as an intermediary and let PHP handle these requests. Of course, Apache works better at serving content, so I would run this apache-less PHP sever on a subdomain that does not serve any content.

@MikeHouston What about trying comet with php in IIS.?

@ravz, there's some stuff here about IIS and comet: stackoverflow.com/questions/1898848/comet-programming-in-iis, but I suspect the fast-cgi PHP module has the same limitations as with apache. It mentions a single threaded environment here: microsoft.com/web/platform/phponwindows.aspx - I don't use Windows servers myself, so I'm not sure about the threading model.

Using comet with PHP? - Stack Overflow

php comet
Rectangle 27 12

Stack Overflow clone in PHP -- "Qwench"

discussion stackexchange clone