Microsoft
Software
Hardware
Network
Question : get value in string - Jquery based & Regular Expression
Hello, I'm being really braind dead here today.. I need to grad a value out of a file.
It looks like this
Version 1.6.7 - Teremba Bay
--------------------------
---
- #3999 Upload a file with apostrophe make problem
- #4137 small text typo in admin/login.php
Version 1.6.6 - Bonde
--------------------------
---
- #3777 Documentation Error: redirect_url plugin
- #3923 Adminlog download, tab separator single quoted
...
and on and on
all I want to do is get the top, the first Version in this case '1.6.7'
I'm strating off with this...
var jQ = jQuery.noConflict();
jQ.get('doc/CHANGELOG.txt'
, function(data) {
var re = new RegExp(/(?:Version)\s+(.*?
)\-(.*?)/)
;
var m = re.exec(data);
if (m == null) {
alert("No match");
} else {
alert(m[0]);
}
so alert(m[0]); should have in this case alerted '1.6.7'
Thank you.. cheers..
Answer : get value in string - Jquery based & Regular Expression
The matched value is in the index: 1
See below:
1: 2: 3: 4: 5:
if (m == null) { alert("No match"); } else { alert(m[1]); }
Random Solutions
How do I set up my wireless network?
change SQLserver 2005 to mix mode
Backup Exec 12 - Catalog issue
Windows 2008 - HP LaserJet 2600n drivers aren't working
making first word bold
Domain rename prior to consolidation
Custom SQL in Web Intelligence Error
SAP RFC returning Invalid Data Type
Add date to MySQL
How do I check if a window is already open or give it focus using Flex/Flash