i have js and a different strings like this:
Tue Aug 11 2015 between 4:00 PM and 5:00 PM
words between and and not changed
But sometimes i can get this string with different amount of spaces between words
Tue Aug 11 2015 between 4:00 PM and 5:00 PM (3 spaces)
or
Tue Aug 11 2015 between 4:00 PM and 5:00 PM (1 spaces)
Is it possible to create a regular expression for this string?
string re1="((?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|Tues|Thur|Thurs|Sun|Mon|Tue|Wed|Thu|Fri|Sat))"; // Day Of Week 1
string re2="(\\s+)"; // White Space 1
string re3="((?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?))"; // Month 1
string re4="(\\s+)"; // White Space 2
string re5="((?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])"; // Day 1
string re6="(\\s+)"; // White Space 3
string re7="((?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3})))(?![\\d])"; // Year 1
string re8="(\\s+)"; // White Space 4
string re9="(\"between\")"; // Double Quote String 1
string re10="(\\s+)"; // White Space 5
string re11="((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; // HourMinuteSec 1
string re12="(\\s+)"; // White Space 6
string re13="(\"and\")"; // Double Quote String 2
string re14="(\\s+)"; // White Space 7
string re15="((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; // HourMinuteSec 2
how to simplify the regular expression for this line?
\s+to denote one or more white space characters.string re1 = "((?:Tues?|Thu(rs?)?|Sun|Mon|Wed|Fri|Sat))"; // Day Of Week 1regexto match multiple spaces,re4 re6 re8 re10 re12 re14can be replaced byre2