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
BIOS update from 02 to 09 in Dell Precision 380
Code Freezes With No Error
deleting the last row of data programatically before importing data
Basic SharePoint 2010 Workflow
Sumproduct formula for total duration based on Month
checkbox and mysql
Need media/download link for Office 2010 Professional OEM
VBA Splitting a line with a comma seperator and quote qualifer
configure samba access to SBS 2008 folders?
How to prohibit user from sending to all mailboxes exept a handful.