Microsoft
Software
Hardware
Network
Question : javascrip string parsing question
Suppose I have strings with below format:
Test 07/2010 (Product 10005)
Test 08/2010 (Product 10006)
In this kind of strings, ony the data field (07 and 2010 and 10005) are changed fields, other parts are fixed. How could I parse this kind of string to get value like:
month: 07
year: 2010
Product: 10005
BTW, for string not staring with "Test", then I do not want to parse it.
Many thanks.
Answer : javascrip string parsing question
if (string.match(/^Test/)) {
var month = string.replace(/^Test\ (\d+)\/\d+\ .*$/, '$1');
var year = string.replace(/^Test\ \d+\/(\d+)\ .*$/, '$1');
var Product = string.replace(/^.*Product
\ (\d+)\)$/, '$1');
}
Random Solutions
SQL Lookup table with multiple references based on update date field
ASA ISA IAS
How to create a left justified value using srring.format?
Moving to another Exchange 2007 Server, do I do anything on the BES for BB mail?
Windows XP Home Edition Version 2002 / SP 3
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource
Add text to text box based on click of checkbox...
Best PC TV Channels or Web Sites
VB.NET 2008 Get resource file as IO.Stream
Access database search query/ vba.