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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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