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
NDR spam on exchange 2003
Changing ownership per KB: 271071 Gets me the hour glass
write to app.config file
PHP array problem (filled with db data)
ESX 4i Problem After RAM Upgrade
Display rows as columns
CAB (inside MSI) files Vs EXE file
Macro to merge columns in Word tables
What do I need to do with my existing win 2003 server DC when adding a Win 2008 SBS in the domain as a GC
basic physics - reflection versus refraction