RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 10
Title Test Details Space Delimited Format (SDF) Parser - backslash escape
Expression
/("(\\["\\]|[^"])*("|$)|\S)+/g
Description
Intended for single line. JavaScript match() method (or equivalent) creates an array of values each of which is either an unquoted string of non-whitespace chars, or a quoted string which can contain whitespace, escaped quotes (\"), escaped escaped chars (\\), or be empty (""). Splits (only) on whitespace. (Does not split on opening or closing quotes.) An unclosed quote matches all until end of input. The Matching Examples are ready for enclosure in single quotes. Output of Matching Example 1: [0]=a [1]=" b b " [2]=c\"c [3]="" [4]="\"" [5]="\\" Output of Matching Example 2: [0]=a" a\""a"a" [1]=" b \" b
Matches
a " b b " c\\"c "" "\\"" "\\\\" | a" a\\""a"a" " b \\" b
Non-Matches
only strings with <1 non-whitespace char
Author Rating: Not yet rated. Brian \S\s
Title Test Details Space Delimited Format (SDF) Parser - double quote escape
Expression
("(?!")(""|[^"])*("|$)|\S)+/g
Description
Intended for single line. JavaScript match() method (or equivalent) creates an array of values each of which is either an unquoted string of non-whitespace chars, or a quoted string which can contain whitespace, escaped quotes (""), escaped escaped chars ("""), or be empty (""). Splits (only) on whitespace. (Does not split on opening or closing quotes.) An unclosed quote matches all until end of input. The Matching Examples are ready for enclosure in single quotes. Output of Matching Example 1: [0]=a [1]=" b b " [2]=c""c [3]="" [4]=""d"" Output of Matching Example 2: [0]=a" a"""a"a" [1]=" b "" b
Matches
a " b b " c""c "" ""d"" | a" a"""a"a" " b "" b
Non-Matches
only strings with <1 non-whitespace char
Author Rating: Not yet rated. Brian \S\s
Title Test Details Text File Parser - splits on unquoted \n - backslash escape - \r\n okay
Expression
/^("(\\["\\]|[^"])*"|[^\n])*(\n|$)/gm
Description
JavaScript match() method (or equivalent) creates an array of lines from a text file. This pattern handles lines ending with \r\n as well as \n at the expense of including the line-ending chars in the output. The Matching Examples are ready for enclosure in single quotes. Output from Matching Example 1: [0]=a " b [\n] " c [\n] [1]= Line2... [\n] [2]= Line3... Output from Matching Example 2: [0]=a " b [\r][\n]" c [\r][\n] [1]= Line2... [\r][\n] [2]= Line3...
Matches
a " b \n " c \n Line2... \n Line3... | a " b \r\n " c \r\n Line2... \r\n Line3...
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
Title Test Details Space Delimited Format (SDF) Parser - backslash escape - splits on whitespace and opening & closing quotes
Expression
/"(\\["\\]|[^"])*("|$)|(\\["\\]|[^\s"])+/g
Description
Intended for single line. JavaScript match() method (or equivalent) creates an array of values each of which is either an unquoted string of non-whitespace chars, or a quoted string which can contain whitespace, escaped quotes (\"), escaped escaped chars (\\), or be empty (""). Splits on whitespace AND splits on opening and closing quotes. An unclosed quote matches all until end of input. The Matching Examples are ready for enclosure in single quotes. Output of Matching Example 1: [0]=a [1]=" b b " [2]=c\"c [3]="" [4]="\"" [5]="\\" Output of Matching Example 2: [0]=a [1]=" b\"" [2]=c [3]="d" [4]=" e \" f
Matches
a " b b " c\\"c "" "\\"" "\\\\" | a" b\\""c"d" " e \\" f
Non-Matches
only strings with <1 non-whitespace char
Author Rating: Not yet rated. Brian \S\s
Title Test Details Space Delimited Format (SDF) Parser - double quote escape - splits on whitespace and opening & closing quotes
Expression
/"(?!")(""|[^"])*("|$)|(("")+|[^\s"])+/g
Description
Intended for single line. JavaScript match() method (or equivalent) creates an array of values each of which is either an unquoted string of non-whitespace chars, or a quoted string which can contain whitespace, escaped quotes (""), escaped escaped chars ("""), or be empty (""). Splits on whitespace AND splits on opening and closing quotes. An unclosed quote matches all until end of input. The Matching Examples are ready for enclosure in single quotes. Output of Matching Example 1: [0]=a [1]=" b b " [2]=c""c [3]="" [4]="""d""" Output of Matching Example 2: [0]=a [1]=" b""" [2]=c [3]="d" [4]=" e "" e
Matches
a " b b " c""c "" """d""" | a" b"""c"d" " e "" e
Non-Matches
only strings with <1 non-whitespace char
Author Rating: Not yet rated. Brian \S\s
Title Test Details Text File Parser - splits on unquoted \n - backslash escape
Expression
/^("(\\["\\]|[^"])*"|[^\n])*$/gm
Description
JavaScript match() method (or equivalent) creates an array of lines from a text file. This pattern only handles lines ending with \n, not \r\n. The Matching Examples are ready for enclosure in single quotes. Output from Matching Example 1: [0]=a " b [\n] " c [1]= Line2... [2]= Line3... Output from Matching Example 2: [0]=a " b [\r][\n]" c [\r] [1]= [2]= Line2... [\r] [3]= [4]= Line3...
Matches
a " b \n " c \n Line2... \n Line3... | a " b \r\n " c \r\n Line2... \r\n Line3...
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
Title Test Details Parse Windows Filename / Pathname (simple version)
Expression
/(?:(.):)?(?:(.*)\\)?(?:(.*)\.)?(.*)/
Description
Does not validate. For parsing a file name known to be valid. Handles periods in the file name. Does not include terminating characters in the output, as preferred. Javascript exec() method produces the following array elements: [1]=drive; [2]=path; IF extension exists THEN [3]=filename; [4]=extension; ELSE [3]=undefined; [4]=filename. (To avoid the awkwardness, see "Parse Windows Filename (complex version)." Matching Example 1 output: [1]=d [2]=\p.p\p [3]=f.f [4]=e Matching Example 2 output: [1]=[undefined] [2]=[empty string] [3]=[undefined] [4]=f Matching Example 3 output: [1]=undefined [2]=undefined [3]=f [4]=e
Matches
'd:\\p.p\\p\\f.f.e' | '\\f' | 'f.e'
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
Title Test Details Parse Windows Filename / Pathname (complex version)
Expression
/(?:(.):)?(?:(.*)\\)?((?:[^.]|.(?=[^.]*\.))*)(?:\.(.*))?/
Description
Does not validate. For parsing a file name known to be valid. Handles periods in the file name. Does not include terminating characters in the output, as preferred. Javascript exec() method produces the following array elements: [1]=drive; [2]=path; [3]=filename; [4]=extension; Matching Example 1 output: [1]=d [2]=\p.p\p [3]=f.f [4]=e Matching Example 2 output: [1]=[undefined] [2]=[empty string] [3]=f [4]=[undefined]
Matches
'd:\\p.p\\p\\f.f.e' | '\\f'
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
Title Test Details Space Delimited Format (SDF) Parser - ' or " mixed - backslash escape - splits on whitespace and opening & closing quotes
Expression
/"(\\["\\]|[^"])*("|$)|'(\\['\\]|[^'])*('|$)|(\\["'\\]|[^\s"'])+/g
Description
Intended for single line. JavaScript match() method (or equivalent) creates an array of values each of which is either an unquoted string of non-whitespace chars, or a quoted string which can contain whitespace, escaped quotes (\' or \"), escaped escaped chars (\\), or be empty ('' or ""). Splits on whitespace AND splits on opening and closing quotes. An unclosed quote matches all until end of input. The Matching Example is ready for enclosure in single quotes. Output of Matching Example: [0]=a [1]=' b"\'b ' [2]='b2' [3]="c\"'c" [4]="d
Matches
a \' b"\\\'b \'\'b2\' "c\\"\'c" "d
Non-Matches
only strings with <1 non-whitespace char
Author Rating: The rating for this expression. Brian \S\s
Title Test Details Text File Parser - splits on unquoted \n - ' or " mixed - backslash escape - \r\n okay
Expression
/^("(\\"|[^"])*"|'(\\'|[^'])*'|[^\n])*(\n|$)/gm
Description
JavaScript match() method (or equivalent) creates an array of lines from a text file. This pattern handles lines ending with \r\n as well as \n at the expense of including the line-ending chars in the output. The Matching Example is ready for enclosure in single quotes. Output from Matching Example: [0]=a " b [\n] " 'c[\n]' [\n] [1]= "a \" ' " b 'c " \' ' [\n] [2]= Line3...
Matches
a " b \n " \'c\n\' \n "a \\" \' " b \'c " \\\' \' \n Line3...
Non-Matches
matches all
Author Rating: Not yet rated. Brian \S\s
   Displaying page 1 of 1 pages; Items 1 to 10

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials