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
How do I make Link Child work with a multi table subform record source?
merge events from one calendar to specific users calendar
Marvel BIOS issue
Passing value from one page textbox to another page textboxes
How to copy line chart color and apply on on the chart title (Excel 2007/VBA)
migrating sbs2003 to a new sbs2008
Nested sql queries insetead of myltiple queries
Who should change IP addresses pointing to MX records?
need to display information with a scroll bar.
SQL 2008 date data type ODBC link to Access 2007 changes to text data type