<< < 1 2 3 4 5 6 >   Sort: Date

Comments in regular expression (?#...)
Is there any way to enter a comment into regular expressions? How to write a regular expression with comments to match date strings in yyyy-mm-dd format like: 2013-01-26 Yes. Comments can be entered in regular expressions using (?#...) format. For example: "(?:[^"\]++(?#no-backtracking) |\.)*+(?#no-b...
2013-01-26, 2165👍, 0💬

Negated word character class - \W
What is abbreviation of a negated character class of all word characters? Does it represents any characters except alphanumeric plus '_' characters? How to write a regular expression using a character class abbreviation to capture all sequences of non word characters in a PHP script code like this: ...
2013-01-23, 2165👍, 0💬

Capturing domain name from URL
How to capture scheme name from URL addresses with a regular expression? Here are URL address examples:ftp://ftp.example.org https://login.example.com:5800 /http://en.wikipedia.org/wiki/W WW.html#Historyfile://localhost/c|/WINDOWS/cl ock.aviURL addresses are written in this format: scheme://domain:p...
2013-02-03, 2159👍, 0💬

Capturing authenticated user name from Apache Web log file
How to capture the authenticated user name from Apache Web log file? Here are some Apache Web log file entries:127.0.0.1 - frank [10/May/2012:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "-" "-" "-" 213.135.131.79 - - [15/May/2012:19:21:49 -0400] "GET /features.htm HTTP/1.1" 200 9955 "http...
2013-02-03, 2157👍, 0💬

None capturing group (?:...)
Is there any to stop capturing a group to improve matching performance? How to write a possessive quantified subpattern to match double-quoted strings like this: "He said: \“Hello!\”"? Yes. To turn the default capturing behavior on a group, you can entered '?:' at the beginning of the group as (?#:....
2013-01-26, 2152👍, 0💬

Regular Expression with Logical AND
How to write AND logic in regular expression? How to build a regular expression to identify the following email paragraph as a spam message because it contains the word "bank", "account" and "money"? "I am inviting you for a business deal where this money will be shared between of us in the ratio of...
2015-05-22, 2151👍, 0💬

Capturing attributes of XML elements
How to capture attributes of XML elements in XML documents? An example XML document is listed below: The regular expression to capture attributes of XML elements in an XML document can be written as: ([^\s=]+)\s*=\s*"((?:[^"]*\")* [^"]*)"Note that: ([^\s=]+) - Attribute name ((?:[^"]*\")*[^"]*) - At...
2013-02-02, 2151👍, 0💬

Validating Canadian Postal Codes
How to write a regular expression to validate Canadian Postal Codes? For example, T2X 1V4 is a valid Canadian postal codes. Here is the regular expression to validate Canadian postal codes: [ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d [ABCEGHJKLMNPRSTVXY] - 18 FSA possible letters \d - A digit [A-Z] - Any...
2013-01-29, 2147👍, 0💬

Capturing host name from Apache Web log file
How to capture the remote host name from Apache Web log file? Here are some Apache Web log file entries:127.0.0.1 - frank [10/May/2012:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "-" "-" "-" 213.135.131.79 - - [15/May/2012:19:21:49 -0400] "GET /features.htm HTTP/1.1" 200 9955 "http://www....
2013-02-03, 2138👍, 0💬

0 or more times repetition quantifier *
What is the 0 or more times repetition quantifier? How to use it? How to write a regular expression using a repetition quantifier to capture all names and values in a URL query string like this: User=Jack&Age=&City=Pa ris?The "0 or more times" repetition quantifier allows us to repeat a patt...
2013-01-26, 2118👍, 0💬

Limited number of repetitions quantifier {n,m}
What is the limited number of repetitions quantifier? How to use it? How to write a regular expression using a repetition quantifier to ensure my password is between 8 and 12 characters long like this one: 9EA979114C? The "limited number of repetitions" quantifier allows us to repeat a pattern unit ...
2013-01-26, 2115👍, 0💬

Finding mismatching quotes in a code line
How to find mismatching quotes "..." in a program code line with a regular expression? The the example program code is listed below:error = "Line "+line+" position "+position+" has invalid character "+char; warning = "The quote character (") may cause problem at line "+line+" position "+position; Th...
2013-02-02, 2104👍, 0💬

Possessive (non-backtracking) quantified subpatterns ++ *+ {}+
What is possessive (non-backtracking) quantified subpatterns? How to write a possessive quantified subpattern to match double-quoted strings like this: "He said: \“Hello!\”"? If you don't want the default backtracking behavior of quantified subpatterns, you can turn it off by adding the "possessive"...
2013-01-26, 2095👍, 0💬

Pattern groups (...)
What is pattern group? What are pattern groups used for? How to write a regular expression using groups to capture character names from the Ed, Edd 'n' Eddy animated comedy television series? The grouping mechanism allows a part of a regex to be treated as a single unit. A group is represented by re...
2013-01-23, 2095👍, 0💬

Exact n times repetition quantifier {n}
What is the exact n times repetition quantifier? How to use it? How to write a regular expression using a repetition quantifier to capture Visa card numbers that have 16 digits like this: 4111111111111111? The "exact n times" repetition quantifier allows us to repeat a pattern unit exactly n times i...
2013-01-26, 2093👍, 0💬

Capturing port number from URL
How to capture port number from URL addresses with a regular expression? Here are URL address examples:ftp://ftp.example.org https://login.example.com:5800 /http://en.wikipedia.org:80/wik i/WWW.html#Historyfile://localhost/c|/WINDOWS/cl ock.aviURL addresses are written in this format: scheme://domai...
2013-02-03, 2080👍, 0💬

Greediness of quantified subpatterns
What is the greediness of quantified subpatterns? What does it mean that a quantified subpattern is "greedy"? How to show that a quantified subpattern is "greedy" on this PHP script: if ($t=10): echo "Just started...!"; endif; if ($t=11): echo "Hungry!"; endif; if ($t=12): echo ""Ah, lunch-time!"; e...
2013-01-26, 2072👍, 0💬

Finding repeating words in a document
How to find repeating words in a text document with a regular expression? An example text document is listed below:After narrowly escaping a sensitive decapitation, Bond Bond is shot with a tranquilizer gun. He wakes up up on a plane to a woman standing over him, who introduces herself: "My name is ...
2013-02-03, 2067👍, 0💬

Start of string anchor ^
What is the "start of string" anchor in a regular expression? How to use it? How to write a regular expression using "start of string" anchor to validate discover credit card numbers like: 6011963280099774? The "start of string" anchor is an atomic zero-width assertion specifing that the match must ...
2013-01-26, 2064👍, 0💬

Backtracking of quantified subpatterns
What is backtracking of quantified subpatterns? What does it mean that a quantified subpattern is "backtracked"? How to show that a quantified subpattern is "backtracked" on this PHP script: if ($t=10): echo "Just started...!"; endif; if ($t=11): echo "Hungry!"; endif; if ($t=12): echo ""Ah, lunch-t...
2013-01-26, 2059👍, 0💬

1 or more times repetition quantifier +
What is the 1 or more times repetition quantifier? How to use it? How to write a regular expression using a repetition quantifier to capture all words in a PHP script code like this: function get($key) {if (array_key_exists($key,$_POST) )return $_POST[$key]; else return "";}? --- Answer The "1 or mo...
2013-01-26, 2051👍, 0💬

1 or 0 times repetition quantifier ?
What is the 1 or 0 times repetition quantifier? How to use it? How to write a regular expression using a 1 or 0 times repetition quantifier to capture both spellings of skilful and skillful? The "1 or 0 times" repetition quantifier allows us to create a special logical OR operation of "match the pat...
2013-01-26, 2046👍, 0💬

End of string anchor $
What is the "end of string" anchor in a regular expression? How to use it? How to write a regular expression using "end of string" anchor to validate words ending in 'z': quartz? The "end of string" anchor is an atomic zero-width assertion specifing that the match must occur at the end of the string...
2013-01-26, 2037👍, 0💬

Parsing Windows TREE Command Output
Regex for parse output of Windows TREE command. For example: Folder PATH listing Volume serial number is 8704-028C C: +---BIOS | \---E0CN23WW | E0CN23WW.exe | +---driveri | 0rww03af.exe | 2tl502af.exe | 2tl602af.exe | 365.10-notebook-win10-64bit-in ternational-whql(1).exe | bob501af.exe | e0cn23ww_i...
2016-06-23, 1704👍, 0💬

<< < 1 2 3 4 5 6 >   Sort: Date