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
Whats the easiest and hopefully no cost way of accessing a users laptop remotely for technical support.
Plasma vs. LCD
How to make a local profile roaming even though option is greyed out
I have 2 ASA5520 x8.0 I want make VPN site to Site but is not work and there are no isakmp sas
reading xml from a string instead of xml file
VLSM
Language setting in Windows server
java.util.MissingResourceE
xception in JSP
Jquery simple tooltip - code example, not plugin
IFrame History